Skip to content

Commit cfb4408

Browse files
authored
Merge pull request #258 from sebastiencs/master
Do not indent where clause by default (follow standard) #257
2 parents 27911c8 + 216faf2 commit cfb4408

File tree

2 files changed

+21
-14
lines changed

2 files changed

+21
-14
lines changed

rust-mode-tests.el

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,8 @@ fn foo4(a:i32,
451451
"))
452452

453453
(ert-deftest indent-body-after-where ()
454-
(test-indent
454+
(let ((rust-indent-where-clause t))
455+
(test-indent
455456
"
456457
fn foo1(a: A, b: B) -> A
457458
where A: Clone + Default, B: Eq {
@@ -469,10 +470,11 @@ fn foo2(a: A, b: B) -> A
469470
bar: 3
470471
}
471472
}
472-
"))
473+
")))
473474

474475
(ert-deftest indent-align-where-clauses-style1a ()
475-
(test-indent
476+
(let ((rust-indent-where-clause t))
477+
(test-indent
476478
"
477479
fn foo1a(a: A, b: B, c: C) -> D
478480
where A: Clone + Default,
@@ -484,10 +486,11 @@ fn foo1a(a: A, b: B, c: C) -> D
484486
bar: 3
485487
}
486488
}
487-
"))
489+
")))
488490

489491
(ert-deftest indent-align-where-clauses-style1b ()
490-
(test-indent
492+
(let ((rust-indent-where-clause t))
493+
(test-indent
491494
"
492495
fn foo1b(a: A, b: B, c: C) -> D
493496
where A: Clone + Default,
@@ -500,7 +503,7 @@ fn foo1b(a: A, b: B, c: C) -> D
500503
bar: 3
501504
}
502505
}
503-
"))
506+
")))
504507

505508
(ert-deftest indent-align-where-clauses-style2a ()
506509
(test-indent
@@ -596,7 +599,8 @@ where A: Clone + Default,
596599
")))
597600

598601
(ert-deftest indent-align-where-clauses-impl-example ()
599-
(test-indent
602+
(let ((rust-indent-where-clause t))
603+
(test-indent
600604
"
601605
impl<'a, K, Q: ?Sized, V, S> Index<&'a Q> for HashMap<K, V, S>
602606
where K: Eq + Hash + Borrow<Q>,
@@ -608,18 +612,19 @@ impl<'a, K, Q: ?Sized, V, S> Index<&'a Q> for HashMap<K, V, S>
608612
bar: 3
609613
}
610614
}
611-
"))
615+
")))
612616

613617
(ert-deftest indent-align-where-clauses-first-line ()
614-
(test-indent
618+
(let ((rust-indent-where-clause t))
619+
(test-indent
615620
"fn foo1(a: A, b: B) -> A
616621
where A: Clone + Default, B: Eq {
617622
let body;
618623
Foo {
619624
bar: 3
620625
}
621626
}
622-
"))
627+
")))
623628

624629
(ert-deftest indent-align-where-in-comment1 ()
625630
(test-indent
@@ -632,17 +637,19 @@ pub struct Region { // <-- this should be flush with left margin!
632637
"))
633638

634639
(ert-deftest indent-align-where-in-comment2 ()
635-
(test-indent
640+
(let ((rust-indent-where-clause t))
641+
(test-indent
636642
"fn foo<F,G>(f:F, g:G)
637643
where F:Send,
638644
// where
639645
G:Sized
640646
{
641647
let body;
642648
}
643-
"))
649+
")))
644650

645651
(ert-deftest indent-align-where-in-comment3 ()
652+
(let ((rust-indent-where-clause t))
646653
(test-indent
647654
"fn foo<F,G>(f:F, g:G)
648655
where F:Send,
@@ -651,7 +658,7 @@ pub struct Region { // <-- this should be flush with left margin!
651658
{
652659
let body;
653660
}
654-
"))
661+
")))
655662

656663
(ert-deftest indent-square-bracket-alignment ()
657664
(test-indent

rust-mode.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
:group 'rust-mode
122122
:safe #'booleanp)
123123

124-
(defcustom rust-indent-where-clause t
124+
(defcustom rust-indent-where-clause nil
125125
"Indent the line starting with the where keyword following a
126126
function or trait. When nil, where will be aligned with fn or trait."
127127
:type 'boolean

0 commit comments

Comments
 (0)