Format rust code in emacs using rustfmt
Emacs Lisp
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

rustfmt.el - OBSOLETE


This package has been merged into rust-mode. Please use that instead.

Format rust code in emacs using rustfmt.


Ensure you are using MELPA:

(require 'package)
(add-to-list 'package-archives
             '("melpa" . "") t)

Then install the "rustfmt" package:

  • M-x package-list-packages
  • Find the "rustfmt" and install with I


Run M-x rustfmt-format-buffer to format the current buffer.

For convenience, you may bind it to a key, such as:

(define-key rust-mode-map (kbd "C-c C-f") #'rustfmt-format-buffer)

Alternatively, run rustfmt before saving rust buffers:

(add-hook 'rust-mode-hook #'rustfmt-enable-on-save)