diff options
| author | brotzeit <brotzeitmacher@gmail.com> | 2021-12-28 13:10:00 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-12-28 13:10:00 +0100 |
| commit | bc71aa60068163166230364d349db56bf534e772 (patch) | |
| tree | d714696dbbb8804d7705fdb8865cd05d2368ce8f /rust-mode.el | |
| parent | 8aebccb077741cc246de22eb3f4f172eac93af84 (diff) | |
| parent | 2d4d2d2722db0ed589f4ba9e7b9ded4bee45eec7 (diff) | |
| download | rust-mode-bc71aa60068163166230364d349db56bf534e772.tar.gz | |
Merge pull request #430 from Chris00/master
Improve and add tests for my previous 2 contributions
Diffstat (limited to 'rust-mode.el')
| -rw-r--r-- | rust-mode.el | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/rust-mode.el b/rust-mode.el index eec6057..773251d 100644 --- a/rust-mode.el +++ b/rust-mode.el @@ -222,12 +222,14 @@ Use idomenu (imenu with `ido-mode') for best mileage.") See `prettify-symbols-compose-predicate'." (and (fboundp 'prettify-symbols-default-compose-p) (prettify-symbols-default-compose-p start end match) - ;; Make sure there is a space before || as it is also used for - ;; functions with 0 arguments. - (not (and (string= match "||") - (save-excursion - (goto-char start) - (looking-back "\\(?:\\<move\\|=\\) *")))))) + ;; Make sure || is not a closure with 0 arguments and && is not + ;; a double reference. + (pcase match + ("||" (not (save-excursion + (goto-char start) + (looking-back "\\(?:\\<move\\|[[({:=,;]\\) *")))) + ("&&" (char-equal (char-after end) ?\s)) + (_ t)))) ;;; Mode @@ -465,7 +467,8 @@ Does not match type annotations of the form \"foo::<\"." ;; Question mark operator ("\\?" . 'rust-question-mark) - ("\\(&\\)'?\\<" 1 'rust-ampersand-face) + ("\\(&+\\)\\(?:'\\(?:\\<\\|_\\)\\|\\<\\|[[({:*_|]\\)" + 1 'rust-ampersand-face) ) ;; Ensure we highlight `Foo` in `struct Foo` as a type. |
