Skip to content

Commit f8d94cb

Browse files
committed
Use catch and throw instead of block and return
Fixes #130
1 parent 6739dd9 commit f8d94cb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

rust-mode.el

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
;;; Code:
1515

1616
(eval-when-compile (require 'rx)
17-
(require 'cl)
1817
(require 'compile)
1918
(require 'url-vars))
2019

@@ -541,17 +540,18 @@ function or trait. When nil, where will be aligned with fn or trait."
541540
"Matches names like \"foo::\" or \"Foo::\" (depending on RE-IDENT, which should match
542541
the desired identifiers), but does not match type annotations \"foo::<\"."
543542
`(lambda (limit)
544-
(block nil
543+
(catch 'rust-path-font-lock-matcher
545544
(while t
546545
(let* ((symbol-then-colons (rx-to-string '(seq (group (regexp ,re-ident)) "::")))
547546
(match (re-search-forward symbol-then-colons limit t)))
548547
(cond
549548
;; If we didn't find a match, there are no more occurrences
550549
;; of foo::, so return.
551-
((null match) (return nil))
550+
((null match) (throw 'rust-path-font-lock-matcher nil))
552551
;; If this isn't a type annotation foo::<, we've found a
553552
;; match, so a return it!
554-
((not (looking-at (rx (0+ space) "<"))) (return match))))))))
553+
((not (looking-at (rx (0+ space) "<")))
554+
(throw 'rust-path-font-lock-matcher match))))))))
555555

556556
(defvar rust-mode-font-lock-keywords
557557
(append

0 commit comments

Comments
 (0)