branch: elpa/rust-mode
commit cfb440810a010b099e7196f8701c9d990a3641d8
Merge: 27911c8 216faf2
Author: Tom Tromey <[email protected]>
Commit: GitHub <[email protected]>
Merge pull request #258 from sebastiencs/master
Do not indent where clause by default (follow standard) #257
---
rust-mode-tests.el | 33 ++++++++++++++++++++-------------
rust-mode.el | 2 +-
2 files changed, 21 insertions(+), 14 deletions(-)
diff --git a/rust-mode-tests.el b/rust-mode-tests.el
index b2e8338..6c6e9af 100644
--- a/rust-mode-tests.el
+++ b/rust-mode-tests.el
@@ -451,7 +451,8 @@ fn foo4(a:i32,
"))
(ert-deftest indent-body-after-where ()
- (test-indent
+ (let ((rust-indent-where-clause t))
+ (test-indent
"
fn foo1(a: A, b: B) -> A
where A: Clone + Default, B: Eq {
@@ -469,10 +470,11 @@ fn foo2(a: A, b: B) -> A
bar: 3
}
}
-"))
+")))
(ert-deftest indent-align-where-clauses-style1a ()
- (test-indent
+ (let ((rust-indent-where-clause t))
+ (test-indent
"
fn foo1a(a: A, b: B, c: C) -> D
where A: Clone + Default,
@@ -484,10 +486,11 @@ fn foo1a(a: A, b: B, c: C) -> D
bar: 3
}
}
-"))
+")))
(ert-deftest indent-align-where-clauses-style1b ()
- (test-indent
+ (let ((rust-indent-where-clause t))
+ (test-indent
"
fn foo1b(a: A, b: B, c: C) -> D
where A: Clone + Default,
@@ -500,7 +503,7 @@ fn foo1b(a: A, b: B, c: C) -> D
bar: 3
}
}
-"))
+")))
(ert-deftest indent-align-where-clauses-style2a ()
(test-indent
@@ -596,7 +599,8 @@ where A: Clone + Default,
")))
(ert-deftest indent-align-where-clauses-impl-example ()
- (test-indent
+ (let ((rust-indent-where-clause t))
+ (test-indent
"
impl<'a, K, Q: ?Sized, V, S> Index<&'a Q> for HashMap<K, V, S>
where K: Eq + Hash + Borrow<Q>,
@@ -608,10 +612,11 @@ impl<'a, K, Q: ?Sized, V, S> Index<&'a Q> for HashMap<K,
V, S>
bar: 3
}
}
-"))
+")))
(ert-deftest indent-align-where-clauses-first-line ()
- (test-indent
+ (let ((rust-indent-where-clause t))
+ (test-indent
"fn foo1(a: A, b: B) -> A
where A: Clone + Default, B: Eq {
let body;
@@ -619,7 +624,7 @@ impl<'a, K, Q: ?Sized, V, S> Index<&'a Q> for HashMap<K, V,
S>
bar: 3
}
}
-"))
+")))
(ert-deftest indent-align-where-in-comment1 ()
(test-indent
@@ -632,7 +637,8 @@ pub struct Region { // <-- this should be flush with left
margin!
"))
(ert-deftest indent-align-where-in-comment2 ()
- (test-indent
+ (let ((rust-indent-where-clause t))
+ (test-indent
"fn foo<F,G>(f:F, g:G)
where F:Send,
// where
@@ -640,9 +646,10 @@ pub struct Region { // <-- this should be flush with left
margin!
{
let body;
}
-"))
+")))
(ert-deftest indent-align-where-in-comment3 ()
+ (let ((rust-indent-where-clause t))
(test-indent
"fn foo<F,G>(f:F, g:G)
where F:Send,
@@ -651,7 +658,7 @@ pub struct Region { // <-- this should be flush with left
margin!
{
let body;
}
-"))
+")))
(ert-deftest indent-square-bracket-alignment ()
(test-indent
diff --git a/rust-mode.el b/rust-mode.el
index 6193ebe..4fc1783 100644
--- a/rust-mode.el
+++ b/rust-mode.el
@@ -121,7 +121,7 @@
:group 'rust-mode
:safe #'booleanp)
-(defcustom rust-indent-where-clause t
+(defcustom rust-indent-where-clause nil
"Indent the line starting with the where keyword following a
function or trait. When nil, where will be aligned with fn or trait."
:type 'boolean