Skip to content

Commit a42e151

Browse files
committed
---
yaml --- r: 95748 b: refs/heads/dist-snap c: 1ad8dbe h: refs/heads/master v: v3
1 parent c051f6b commit a42e151

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: c274a6888410ce3e357e014568b43310ed787d36
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: c20186bde5cc0129e4211fc766f117bf43a4b360
9+
refs/heads/dist-snap: 1ad8dbe42e2c9d5aa7e8fda39794cc84ec91972f
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/etc/vim/indent/rust.vim

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
" Vim indent file
22
" Language: Rust
33
" Author: Chris Morgan <[email protected]>
4-
" Last Change: 2013 Jul 10
4+
" Last Change: 2013 Oct 29
55

66
" Only load this indent file when no other was loaded.
77
if exists("b:did_indent")
@@ -104,8 +104,23 @@ function GetRustIndent(lnum)
104104
let prevline = s:get_line_trimmed(prevnonblank(a:lnum - 1))
105105
if prevline[len(prevline) - 1] == ","
106106
\ && s:get_line_trimmed(a:lnum) !~ "^\\s*[\\[\\]{}]"
107+
\ && prevline !~ "^\\s*fn\\s"
107108
" Oh ho! The previous line ended in a comma! I bet cindent will try to
108-
" take this too far... For now, let's use the previous line's indent
109+
" take this too far... For now, let's normally use the previous line's
110+
" indent.
111+
112+
" One case where this doesn't work out is where *this* line contains
113+
" square or curly brackets; then we normally *do* want to be indenting
114+
" further.
115+
"
116+
" Another case where we don't want to is one like a function
117+
" definition with arguments spread over multiple lines:
118+
"
119+
" fn foo(baz: Baz,
120+
" baz: Baz) // <-- cindent gets this right by itself
121+
"
122+
" There are probably other cases where we don't want to do this as
123+
" well. Add them as needed.
109124
return GetRustIndent(a:lnum - 1)
110125
endif
111126

0 commit comments

Comments
 (0)