summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSibi Prabakaran <sibi@psibi.in>2024-02-24 18:00:43 +0530
committerGitHub <noreply@github.com>2024-02-24 18:00:43 +0530
commit25c2535a11fbf34f47078730abfad6f8ae2c9376 (patch)
treeddc8b1be1974ad2baa09f65ff9baafc89c6c1c88
parentbff7bd3043d70412a2abd840232b1251ae8c6226 (diff)
parent2f58eee672ac467d333cf336a38cda859e4fcfd2 (diff)
downloadrust-mode-25c2535a11fbf34f47078730abfad6f8ae2c9376.tar.gz
Merge pull request #513 from rust-lang/509-warnings
Fix native compile warnings
-rw-r--r--Changelog.md4
-rw-r--r--rust-utils.el38
2 files changed, 23 insertions, 19 deletions
diff --git a/Changelog.md b/Changelog.md
new file mode 100644
index 0000000..a506866
--- /dev/null
+++ b/Changelog.md
@@ -0,0 +1,4 @@
+# Unreleased
+
+- Add support for treesitter mode.
+- Fix warnings resulting from rust-utils.el. [Fixes #509](https://github.com/rust-lang/rust-mode/issues/509).
diff --git a/rust-utils.el b/rust-utils.el
index cb55172..d93bd0a 100644
--- a/rust-utils.el
+++ b/rust-utils.el
@@ -41,22 +41,22 @@ visit the new file."
if not. Move cursor to the end of macro."
(when (rust-in-str)
(up-list -1 t t))
- (setq safe-to-forward t)
- (save-excursion
- (condition-case nil
- (forward-sexp)
- (error (setq safe-to-forward nil)
- nil)))
- (cond
- ((not safe-to-forward)
- (rust-insert-dbg-alone))
- (t
- (insert "(")
- (forward-sexp)
- (insert ")")
- (backward-sexp)
- (insert "dbg!")
- (forward-sexp))))
+ (let ((safe-to-forward t))
+ (save-excursion
+ (condition-case nil
+ (forward-sexp)
+ (error (setq safe-to-forward nil)
+ nil)))
+ (cond
+ ((not safe-to-forward)
+ (rust-insert-dbg-alone))
+ (t
+ (insert "(")
+ (forward-sexp)
+ (insert ")")
+ (backward-sexp)
+ (insert "dbg!")
+ (forward-sexp)))))
(defun rust-insert-dbg-region ()
"Insert the dbg! macro around a region. Move cursor to the end of macro."
@@ -77,9 +77,9 @@ if not. Move cursor to the end of macro."
(defun rust-dbg-wrap-or-unwrap ()
"Either remove or add the dbg! macro."
(interactive)
-
+
(cond
-
+
;; region
((region-active-p)
(rust-insert-dbg-region))
@@ -106,7 +106,7 @@ if not. Move cursor to the end of macro."
(delete-pair))
(t (rust-insert-dbg-sexp)))))
)
-)
+ )
(defun rust-toggle-mutability ()
"Toggles the mutability of the variable defined on the current line"