Skip to content

Commit dd1f0e8

Browse files
committed
---
yaml --- r: 79425 b: refs/heads/snap-stage3 c: 9ef0b9c h: refs/heads/master i: 79423: ab19176 v: v3
1 parent 6e8a07d commit dd1f0e8

File tree

2 files changed

+15
-18
lines changed

2 files changed

+15
-18
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 124eb2119c78651cfaaa7a046a101fa2e20f83ca
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 1c527dfcd466d9b5ea75fe199c364837298a4278
4+
refs/heads/snap-stage3: 9ef0b9c0d6180f0e5023b29ac57835e6e75517d0
55
refs/heads/try: ac820906c0e53eab79a98ee64f7231f57c3887b4
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/etc/emacs/rust-mode.el

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@
4545
(if (/= starting (point))
4646
(rust-rewind-irrelevant))))
4747

48+
(defun rust-first-indent-after-brace ()
49+
(save-excursion
50+
(forward-char)
51+
(if (looking-at "[[:blank:]]*\\(?://.*\\)?$")
52+
;; We don't want to indent out to the open bracket if the
53+
;; open bracket ends the line
54+
(* rust-indent-offset (rust-paren-level))
55+
(when (looking-at "[[:space:]]") (forward-to-word 1))
56+
(current-column))))
57+
4858
(defun rust-mode-indent-line ()
4959
(interactive)
5060
(let ((indent
@@ -58,7 +68,7 @@
5868
;; A closing brace is 1 level unindended
5969
((looking-at "}") (* rust-indent-offset (- level 1)))
6070

61-
; Doc comments in /** style with leading * indent to line up the *s
71+
;; Doc comments in /** style with leading * indent to line up the *s
6272
((and (nth 4 (syntax-ppss)) (looking-at "*"))
6373
(+ 1 (* rust-indent-offset level)))
6474

@@ -75,22 +85,9 @@
7585
(let ((pt (point)))
7686
(rust-rewind-irrelevant)
7787
(backward-up-list)
78-
(cond
79-
((and
80-
(looking-at "[[(]")
81-
; We don't want to indent out to the open bracket if the
82-
; open bracket ends the line
83-
(save-excursion
84-
(forward-char)
85-
(not (looking-at "[[:space:]]*\\(?://.*\\)?$"))))
86-
(+ 1 (current-column)))
87-
;; Check for fields on the same line as the open curly brace:
88-
((looking-at "{[[:space:]]*[^\n]*,[[:space:]]*$")
88+
(if (looking-at "[[({]")
89+
(rust-first-indent-after-brace)
8990
(progn
90-
(forward-char)
91-
(when (looking-at "[[:space:]]") (forward-to-word 1))
92-
(current-column)))
93-
(t (progn
9491
(goto-char pt)
9592
(back-to-indentation)
9693
(if (looking-at "\\<else\\>")
@@ -105,7 +102,7 @@
105102
(back-to-indentation)
106103
(if (looking-at "#")
107104
(* rust-indent-offset level)
108-
(* rust-indent-offset (+ 1 level)))))))))))
105+
(* rust-indent-offset (+ 1 level))))))))))
109106

110107
;; Otherwise we're in a column-zero definition
111108
(t 0))))))

0 commit comments

Comments
 (0)