runtime(rust): fix rust indent (#12542)

Commit: 
https://github.com/vim/vim/commit/478668013f060a75b8cd8cc6ca2cf2abb3bcc4a5
Author: Raphael <[email protected]>
Date:   Mon Aug 21 02:42:39 2023 +0800

    runtime(rust): fix rust indent (https://github.com/vim/vim/issues/12542)

diff --git a/runtime/indent/rust.vim b/runtime/indent/rust.vim
index d30629b64..2b544f4a6 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'

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/E1qXnQA-00AsLw-Qf%40256bit.org.

Raspunde prin e-mail lui