diff options
author | Raphael <glephunter@gmail.com> | 2023-08-21 02:42:39 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-20 20:42:39 +0200 |
commit | 478668013f060a75b8cd8cc6ca2cf2abb3bcc4a5 (patch) | |
tree | 197415d8d12e7e62c088e570ceefbe91190667bf /runtime/indent | |
parent | 17befac581ea67f56039db832d68963cd401fb8a (diff) |
runtime(rust): fix rust indent (#12542)
Diffstat (limited to 'runtime/indent')
-rw-r--r-- | runtime/indent/rust.vim | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/runtime/indent/rust.vim b/runtime/indent/rust.vim index d30629b64e..2b544f4a67 100644 --- a/runtime/indent/rust.vim +++ b/runtime/indent/rust.vim @@ -132,6 +132,22 @@ function GetRustIndent(lnum) return indent(prevlinenum) + 6 endif + "match newline after struct with generic bound like + "struct SomeThing<T> + "| <-- newline indent should same as prevline + if prevline[len(prevline) - 1] == ">" + \ && prevline =~# "\s*struct.*>$" + return indent(prevlinenum) + endif + + "match newline after where like: + "struct SomeThing<T> + "where + " T: Display, + if prevline =~# '^\s*where$' + return indent(prevlinenum) + 4 + endif + if prevline[len(prevline) - 1] == "," \ && s:get_line_trimmed(a:lnum) !~ '^\s*[\[\]{}]' \ && prevline !~ '^\s*fn\s' |