Skip to content

Commit 493cc99

Browse files
committed
Merge pull request #52 from GBGamer/fix-indent
Fix "-> Type" on a single line indentation
2 parents 2be934c + ce976b9 commit 493cc99

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

rust-mode.el

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@
102102
(defun rust-rewind-to-beginning-of-current-level-expr ()
103103
(let ((current-level (rust-paren-level)))
104104
(back-to-indentation)
105+
(when (looking-at "->")
106+
(rust-rewind-irrelevant)
107+
(back-to-indentation))
105108
(while (> (rust-paren-level) current-level)
106109
(backward-up-list)
107110
(back-to-indentation))))
@@ -179,7 +182,7 @@
179182
(+ (current-column) rust-indent-offset))))))
180183
(cond
181184
;; Indent inside a non-raw string only if the the previous line
182-
;; ends with a backslash that is is inside the same string
185+
;; ends with a backslash that is inside the same string
183186
((nth 3 (syntax-ppss))
184187
(let*
185188
((string-begin-pos (nth 8 (syntax-ppss)))
@@ -232,7 +235,7 @@
232235
(or (rust-align-to-expr-after-brace)
233236
(+ baseline rust-indent-offset))))
234237

235-
;; A closing brace is 1 level unindended
238+
;; A closing brace is 1 level unindented
236239
((looking-at "}") (- baseline rust-indent-offset))
237240

238241
;; Doc comments in /** style with leading * indent to line up the *s

0 commit comments

Comments
 (0)