Skip to content

Commit 5cf4207

Browse files
committed
copy command rustic-toggle-mutability from #194
1 parent 63ea805 commit 5cf4207

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

rust-utils.el

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,15 @@ visit the new file."
7777
(delete-pair))
7878
(t (rust-insert-dbg)))))))
7979

80+
(defun rustic-toggle-mutability ()
81+
"Toggles the mutability of the variable defined on the current line"
82+
(interactive)
83+
(save-excursion
84+
(back-to-indentation)
85+
(forward-word)
86+
(if (string= " mut" (buffer-substring (point) (+ (point) 4)))
87+
(delete-region (point) (+ (point) 4))
88+
(insert " mut"))))
8089
;;; _
8190
(provide 'rust-utils)
8291
;;; rust-utils.el ends here

0 commit comments

Comments
 (0)