From 2df6cf72163db57fd0c79fefd0e79f38f29f7d93 Mon Sep 17 00:00:00 2001 From: Nathan Moreau Date: Sun, 22 Mar 2020 18:49:28 +0100 Subject: Don't fail on re-search-forward. (#359) --- rust-mode.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'rust-mode.el') diff --git a/rust-mode.el b/rust-mode.el index 59d6675..e7ef1ef 100644 --- a/rust-mode.el +++ b/rust-mode.el @@ -1483,7 +1483,7 @@ This is written mainly to be used as `end-of-defun-function' for Rust." (defun rust--format-fix-rustfmt-buffer (buffer-name) (with-current-buffer (get-buffer rust-rustfmt-buffername) (goto-char (point-min)) - (while (re-search-forward "--> :") + (while (re-search-forward "--> :" nil t) (replace-match (format "--> %s:" buffer-name))))) ;; If rust-mode has been configured to navigate to source of the error @@ -1514,7 +1514,7 @@ rustfmt complain in the echo area." (let ((target-buffer (with-current-buffer rustfmt (save-excursion (goto-char (point-min)) - (when (re-search-forward "--> \\([^:]+\\):") + (when (re-search-forward "--> \\([^:]+\\):" nil t) (match-string 1))))) (target-point (with-current-buffer rustfmt ;; No save-excursion, this is how we cycle through! -- cgit v1.2.3