From 11d98a07dc5ad7e8af8971f1ba5352cc7140b1dc Mon Sep 17 00:00:00 2001 From: Ivan Tham Date: Sun, 27 Sep 2020 15:52:42 +0800 Subject: [PATCH] Rust align open paren for if and for --- rc/filetype/rust.kak | 2 +- test/indent/rust/on-open-paren/in | 9 +++++++++ test/indent/rust/on-open-paren/out | 9 +++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/rc/filetype/rust.kak b/rc/filetype/rust.kak index d7ff49520..a06ae7d14 100644 --- a/rc/filetype/rust.kak +++ b/rc/filetype/rust.kak @@ -174,7 +174,7 @@ define-command -hidden rust-indent-on-opening-curly-brace %[ # align indent with opening paren when { is entered on a new line after the closing paren try %[ execute-keys -draft h ) M \A\(.*\)\h*\n\h*\{\z s \A|.\z 1 ] # dedent standalone { after impl and related block without any { in between - try %< execute-keys -draft hh impl|fn|struct|enum|union \{ ll ^\h*\{$ > + try %< execute-keys -draft hh impl|fn|struct|enum|union|if|for \{ ll ^\h*\{$ > _ ] diff --git a/test/indent/rust/on-open-paren/in b/test/indent/rust/on-open-paren/in index 1ca71d623..661f2331b 100644 --- a/test/indent/rust/on-open-paren/in +++ b/test/indent/rust/on-open-paren/in @@ -33,3 +33,12 @@ union X where T: Debug %( ) + if foo() + && bar() + %( ) + + for x in group + .iter() + .sorted_by(|a, b| Ord::cmp(&a.0, &b.0)) + %( ) + diff --git a/test/indent/rust/on-open-paren/out b/test/indent/rust/on-open-paren/out index de125ea77..60973f8ae 100644 --- a/test/indent/rust/on-open-paren/out +++ b/test/indent/rust/on-open-paren/out @@ -33,3 +33,12 @@ union X where T: Debug { + if foo() + && bar() + { + + for x in group + .iter() + .sorted_by(|a, b| Ord::cmp(&a.0, &b.0)) + { +