Skip to content

Commit b553944

Browse files
committed
auto merge of #13729 : chris-morgan/rust/fix-vim-indent, r=alexcrichton
The change in #13600 was incorrect, containing a bad regular expression; inside an indent function, errors are silently ignored (and the ``~=`` operation will return 0), so it just always failed, causing the cases that were supposed to be caught to not be caught and making things like the ``match`` example shown above or struct field definitions regress. I have fixed the regular expression to what it should have been. This is still imperfect, of course, not handling cases like where the first argument to a function is a function call (``foo(bar(),``), but it'll do for now. ---- I have a general request to make of reviewers about any changes made to `src/etc/vim`: **please tell me**. As a general rule I want to review them. (I’ll make an exception for changes the prelude; it needs fixing from time to time when some people don’t update the syntax file, anyway.) cc @brandonw
2 parents 7d70434 + 7266587 commit b553944

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/etc/vim/indent/rust.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ function GetRustIndent(lnum)
105105
if prevline[len(prevline) - 1] == ","
106106
\ && s:get_line_trimmed(a:lnum) !~ "^\\s*[\\[\\]{}]"
107107
\ && prevline !~ "^\\s*fn\\s"
108-
\ && prevline !~ "\\([^\\(\\)]\+,$"
108+
\ && prevline !~ "([^()]\\+,$"
109109
" Oh ho! The previous line ended in a comma! I bet cindent will try to
110110
" take this too far... For now, let's normally use the previous line's
111111
" indent.

0 commit comments

Comments
 (0)