diff options
| author | Matt Kraai <kraai@ftbfs.org> | 2016-03-06 06:39:22 -0800 |
|---|---|---|
| committer | Matt Kraai <kraai@ftbfs.org> | 2016-03-06 06:46:43 -0800 |
| commit | f8d94cb53cdfc22cf715edd16cf0f0f8fadffbf3 (patch) | |
| tree | aef5d763f5f1a9f20860b092251fe7a91f8aca7d /rust-mode.el | |
| parent | 6739dd9d6312f231a9a9ed550939994adca271d6 (diff) | |
| download | rust-mode-f8d94cb53cdfc22cf715edd16cf0f0f8fadffbf3.tar.gz | |
Use catch and throw instead of block and return
Fixes #130
Diffstat (limited to 'rust-mode.el')
| -rw-r--r-- | rust-mode.el | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/rust-mode.el b/rust-mode.el index 56b356d..fdde64f 100644 --- a/rust-mode.el +++ b/rust-mode.el @@ -14,7 +14,6 @@ ;;; Code: (eval-when-compile (require 'rx) - (require 'cl) (require 'compile) (require 'url-vars)) @@ -541,17 +540,18 @@ function or trait. When nil, where will be aligned with fn or trait." "Matches names like \"foo::\" or \"Foo::\" (depending on RE-IDENT, which should match the desired identifiers), but does not match type annotations \"foo::<\"." `(lambda (limit) - (block nil + (catch 'rust-path-font-lock-matcher (while t (let* ((symbol-then-colons (rx-to-string '(seq (group (regexp ,re-ident)) "::"))) (match (re-search-forward symbol-then-colons limit t))) (cond ;; If we didn't find a match, there are no more occurrences ;; of foo::, so return. - ((null match) (return nil)) + ((null match) (throw 'rust-path-font-lock-matcher nil)) ;; If this isn't a type annotation foo::<, we've found a ;; match, so a return it! - ((not (looking-at (rx (0+ space) "<"))) (return match)))))))) + ((not (looking-at (rx (0+ space) "<"))) + (throw 'rust-path-font-lock-matcher match)))))))) (defvar rust-mode-font-lock-keywords (append |
