branch: elpa/rust-mode
commit 6252cf188390992c3ea47842e75840fd63c7f6c1
Author: Eivind Fonn <[email protected]>
Commit: Eivind Fonn <[email protected]>
Fix indentation of closing delimiters
---
rust-mode-tests.el | 19 +++++++++++++++++++
rust-mode.el | 2 +-
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/rust-mode-tests.el b/rust-mode-tests.el
index e41245f..8375d35 100644
--- a/rust-mode-tests.el
+++ b/rust-mode-tests.el
@@ -631,6 +631,25 @@ fn args_on_the_next_line( // with a comment
}
"))
+(ert-deftest indent-closing-square-bracket ()
+ (test-indent
+ "fn blergh() {
+ let list = vec![
+ 1,
+ 2,
+ 3,
+ ];
+}"))
+
+(ert-deftest indent-closing-paren ()
+ (test-indent
+ "fn blergh() {
+ call(
+ a,
+ function
+ );
+}"))
+
(ert-deftest indent-nested-fns ()
(test-indent
"
diff --git a/rust-mode.el b/rust-mode.el
index 4697c70..a1a3db4 100644
--- a/rust-mode.el
+++ b/rust-mode.el
@@ -373,7 +373,7 @@ function or trait. When nil, where will be aligned with fn
or trait."
(+ baseline rust-indent-offset))))
;; A closing brace is 1 level unindented
- ((looking-at "}") (- baseline rust-indent-offset))
+ ((looking-at "[]})]") (- baseline rust-indent-offset))
;; Doc comments in /** style with leading * indent to line up
the *s
((and (nth 4 (syntax-ppss)) (looking-at "*"))