summaryrefslogtreecommitdiff
path: root/rust-utils.el
diff options
context:
space:
mode:
Diffstat (limited to 'rust-utils.el')
-rw-r--r--rust-utils.el9
1 files changed, 9 insertions, 0 deletions
diff --git a/rust-utils.el b/rust-utils.el
index 022973b..d44a609 100644
--- a/rust-utils.el
+++ b/rust-utils.el
@@ -77,6 +77,15 @@ visit the new file."
(delete-pair))
(t (rust-insert-dbg)))))))
+(defun rustic-toggle-mutability ()
+ "Toggles the mutability of the variable defined on the current line"
+ (interactive)
+ (save-excursion
+ (back-to-indentation)
+ (forward-word)
+ (if (string= " mut" (buffer-substring (point) (+ (point) 4)))
+ (delete-region (point) (+ (point) 4))
+ (insert " mut"))))
;;; _
(provide 'rust-utils)
;;; rust-utils.el ends here