emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/rust-mode 92584c3 209/486: Fix the special case for the fi


From: ELPA Syncer
Subject: [nongnu] elpa/rust-mode 92584c3 209/486: Fix the special case for the first line
Date: Sat, 7 Aug 2021 09:25:20 -0400 (EDT)

branch: elpa/rust-mode
commit 92584c303acc417501d1faa593ff1392fd306c1d
Author: mrBliss <dewinant@gmail.com>
Commit: mrBliss <dewinant@gmail.com>

    Fix the special case for the first line
    
    This special case broke indentation of `where` clauses.
---
 rust-mode-tests.el | 11 +++++++++++
 rust-mode.el       |  7 ++++---
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/rust-mode-tests.el b/rust-mode-tests.el
index e224e67..cc76007 100644
--- a/rust-mode-tests.el
+++ b/rust-mode-tests.el
@@ -603,6 +603,17 @@ impl<'a, K, Q: ?Sized, V, S> Index<&'a Q> for HashMap<K, 
V, S>
 }
 "))
 
+(ert-deftest indent-align-where-clauses-first-line ()
+  (test-indent
+   "fn foo1(a: A, b: B) -> A
+    where A: Clone + Default, B: Eq {
+    let body;
+    Foo {
+        bar: 3
+    }
+}
+"))
+
 (ert-deftest indent-square-bracket-alignment ()
   (test-indent
    "
diff --git a/rust-mode.el b/rust-mode.el
index d857f25..6b09580 100644
--- a/rust-mode.el
+++ b/rust-mode.el
@@ -444,10 +444,11 @@ function or trait.  When nil, where will be aligned with 
fn or trait."
 
                        (save-excursion
                          (rust-rewind-irrelevant)
-                         ;; Point is now at the end of the previous ine
+                         ;; Point is now at the end of the previous line
                          (or
-                          ;; If we are at the first line, no indentation is 
needed, so stay at baseline...
-                          (= 1 (line-number-at-pos (point)))
+                          ;; If we are at the start of the buffer, no
+                          ;; indentation is needed, so stay at baseline...
+                          (= (point) 1)
                           ;; ..or if the previous line ends with any of these:
                           ;;     { ? : ( , ; [ }
                           ;; then we are at the beginning of an expression, so 
stay on the baseline...



reply via email to

[Prev in Thread] Current Thread [Next in Thread]