Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix native compile warnings #513

Merged
merged 2 commits into from
Feb 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -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).
38 changes: 19 additions & 19 deletions rust-utils.el
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand All @@ -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))
Expand All @@ -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"
Expand Down
Loading