[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/rust-mode f269c5e 292/486: fix syntax of "<" appearing aft
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/rust-mode f269c5e 292/486: fix syntax of "<" appearing after "?" |
Date: |
Sat, 7 Aug 2021 09:25:38 -0400 (EDT) |
branch: elpa/rust-mode
commit f269c5ed312715fe862a32fae79f3e12131b1b7a
Author: Tom Tromey <tom@tromey.com>
Commit: Tom Tromey <tom@tromey.com>
fix syntax of "<" appearing after "?"
The "<" syntax-setting code could be confused after a "?". This patch
changes the code to treat "?" as an "ambiguous operator" and adjust
according to further context.
Fixes #200
---
rust-mode-tests.el | 7 +++++++
rust-mode.el | 3 +++
2 files changed, 10 insertions(+)
diff --git a/rust-mode-tests.el b/rust-mode-tests.el
index f7c2a91..dc561e1 100644
--- a/rust-mode-tests.el
+++ b/rust-mode-tests.el
@@ -1891,6 +1891,13 @@ fn main() {
"))
(test-indent text text)))
+(ert-deftest indent-question-mark-operator ()
+ (test-indent "fn foo() {
+ if bar()? < 1 {
+ }
+ baz();
+}"))
+
(defun rust-test-matching-parens (content pairs &optional nonparen-positions)
"Assert that in rust-mode, given a buffer with the given `content',
emacs's paren matching will find all of the pairs of positions
diff --git a/rust-mode.el b/rust-mode.el
index 4fadd81..00714a9 100644
--- a/rust-mode.el
+++ b/rust-mode.el
@@ -1012,6 +1012,9 @@ the desired identifiers), but does not match type
annotations \"foo::<\"."
((rust-looking-back-symbols rust-mode-keywords)
(rust-looking-back-symbols '("self" "true" "false")))
+ ((rust-looking-back-str "?")
+ (rust-is-in-expression-context 'ambiguous-operator))
+
;; If we're looking back at an identifier, this depends on whether
;; the identifier is part of an expression or a type
((rust-looking-back-ident)
- [nongnu] elpa/rust-mode 04e3078 347/486: Merge pull request #244 from kubo39/percent-as-punctuation-character, (continued)
- [nongnu] elpa/rust-mode 04e3078 347/486: Merge pull request #244 from kubo39/percent-as-punctuation-character, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode b911835 356/486: Merge pull request #262 from kngwyu/highlight-dyn, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode cc2435b 359/486: Merge pull request #264 from jjwest/master, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 3ced187 360/486: remove old-style compilation regex; support `:::` regex, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 07e16c6 364/486: Merge pull request #265 from brotzeit/infotype, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode ee262cc 373/486: Merge pull request #266 from brotzeit/format-on-save, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 12cb169 375/486: Merge pull request #284 from riscy/master, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 8452093 278/486: put remaining defcustoms into the rust-mode group, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 8f1297a 281/486: Merge pull request #187 from tspiteri/format-other-buffers, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 5c68caf 282/486: Merge pull request #175 from mrBliss/imenu-unsafe, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode f269c5e 292/486: fix syntax of "<" appearing after "?",
ELPA Syncer <=
- [nongnu] elpa/rust-mode 491ae0e 301/486: Remove unnecessary debugging message, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 60a1f36 310/486: Merge pull request #216 from Aankhen/set-compile-command, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 128601b 317/486: Improve content of `test-project/Cargo.toml'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 30a9d39 322/486: Merge pull request #221 from Wilfred/highlight_union_contextual_keyword, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 6093d38 327/486: Add syntax coloring for type-inferred constants and variables, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 38f7d89 330/486: Fix recognition of "<" as operator in some context, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 0ded5ea 332/486: Add support for u128 and i128 types, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode f57a8eb 333/486: Merge pull request #233 from shanavas786/add-128, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 6b71c0a 348/486: fix rust--format-call, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode a90730f 349/486: don't set-window-start for selected window, ELPA Syncer, 2021/08/07