[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/rust-mode b861aa9 358/486: Fixed indent when ? operator is
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/rust-mode b861aa9 358/486: Fixed indent when ? operator is used in chained method calls |
Date: |
Sat, 7 Aug 2021 09:25:52 -0400 (EDT) |
branch: elpa/rust-mode
commit b861aa9e54e2af362d702ae4bf8741ea4617dc3c
Author: Jonas Westlund <jonaswestlund101@gmail.com>
Commit: Jonas Westlund <jonaswestlund101@gmail.com>
Fixed indent when ? operator is used in chained method calls
---
rust-mode-tests.el | 24 ++++++++++++++++++++++++
rust-mode.el | 4 ++--
2 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/rust-mode-tests.el b/rust-mode-tests.el
index fd29d5d..3e6c67a 100644
--- a/rust-mode-tests.el
+++ b/rust-mode-tests.el
@@ -1668,6 +1668,18 @@ fn main() {
"
)))
+(ert-deftest indent-method-chains-no-align-with-question-mark-operator ()
+ (let ((rust-indent-method-chain nil)) (test-indent
+ "
+fn main() {
+ let x = thing.do_it()
+ .aligned()
+ .more_alignment()?
+ .more_alignment();
+}
+"
+ )))
+
(ert-deftest indent-method-chains-with-align ()
(let ((rust-indent-method-chain t)) (test-indent
"
@@ -1679,6 +1691,18 @@ fn main() {
"
)))
+(ert-deftest indent-method-chains-with-align-with-question-mark-operator ()
+ (let ((rust-indent-method-chain t)) (test-indent
+ "
+fn main() {
+ let x = thing.do_it()
+ .aligned()
+ .more_alignment()?
+ .more_alignment();
+}
+"
+ )))
+
(ert-deftest indent-method-chains-with-align-and-second-stmt ()
(let ((rust-indent-method-chain t)) (test-indent
"
diff --git a/rust-mode.el b/rust-mode.el
index 0c31b6c..908b892 100644
--- a/rust-mode.el
+++ b/rust-mode.el
@@ -320,7 +320,7 @@ buffer."
(- (current-column) rust-indent-offset)))))
(cond
;; foo.bar(...)
- ((rust-looking-back-str ")")
+ ((looking-back "[)?]" (1- (point)))
(backward-list 1)
(funcall skip-dot-identifier))
@@ -501,7 +501,7 @@ buffer."
;; ..or if the previous line ends with any of these:
;; { ? : ( , ; [ }
;; then we are at the beginning of an expression, so
stay on the baseline...
- (looking-back "[(,:;?[{}]\\|[^|]|" (- (point) 2))
+ (looking-back "[(,:;[{}]\\|[^|]|" (- (point) 2))
;; or if the previous line is the end of an
attribute, stay at the baseline...
(progn
(rust-rewind-to-beginning-of-current-level-expr) (looking-at "#")))))
baseline
- [nongnu] elpa/rust-mode 06b3b60 412/486: update readme (#327), (continued)
- [nongnu] elpa/rust-mode 06b3b60 412/486: update readme (#327), ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode c0cc6dc 420/486: Allow pass custom flags to rustfmt. (#338), ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 888f3de 442/486: rust--format-fix-rustfmt-buffer: replace "stdin:" as well as "<stdin>:"., ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode ef152ad 459/486: Minor fixes (#388), ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 0797e7b 017/486: add Url, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 5375e54 454/486: Test byte compilation of test code., ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 33d178d 030/486: Make 'foo use font-lock-builtin-face, like module names, and make capitalized identifiers optionally use font-lock-type-face, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 9e2221c 034/486: Fix typo, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 8f926be 031/486: Emacs: Update emacs mode to be more similar to the vim mode., ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode cfb4408 354/486: Merge pull request #258 from sebastiencs/master, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode b861aa9 358/486: Fixed indent when ? operator is used in chained method calls,
ELPA Syncer <=
- [nongnu] elpa/rust-mode 31b8453 361/486: update to include line number and column information, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 3254297 366/486: Bump version, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode d3a7025 377/486: Merge pull request #292 from mookid/imenu-impl, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode dd231ed 383/486: Avoid signaling "Beginning of buffer" in rust-lookng-back-macro, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode b7237b0 405/486: Add rust-format-diff-buffer, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 10ba29e 406/486: Silence byte-compiler, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode c8217a3 425/486: Fix rust-insert-dbg for emacs-version < 25. (#339), ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 0e25008 043/486: rust-mode: Default rust-indent-offset to 4, not default-tab-width, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 679501e 056/486: Cover all cases for padding in paragraph fills as intended, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode bee96e8 067/486: Fix emacs indentation of multi-line match patterns, ELPA Syncer, 2021/08/07