ArenzanaArenzana
  • blog
  • home
  • blog
  • home

Emacs for Rust Development

January 11, 2022 isma
Emacs

Emacs > Visual Studio Code


There’s a good chance I’m a hater or that I don’t know what I’m doing. After a couple of hours trying to set up VS Code for Rust development, I ended up frustrated not understanding how to simply call the compiler or the debugger from the interface. I looked for rust-mode on Github and 15 minutes later I was up and running on Emacs. Maybe it’s my previous experience with Go development set ups that made it all quite simple.

Rust on Emacs

I approached this the same way I approached Go: let’s get regular syntax highlighting, linting, formatting, and compiling first and we’ll worry about debuggers later. I’m a bit old school when it comes to approaching debugging.nWe end up with the following on the Emacs config:

(use-package rust-mode
:defer t
:ensure t
:init(
add-hook 'rust-mode-hook(lambda() (setq indent-tabs-mode nil)))
(setq rust-format-on-save t)
(add-hook 'rust-mode-hook(lambda() (prettify-symbols-mode)))
(add-hook 'rust-mode-hook #' lsp)
:bind(("M-," . rust-compile)))

(use-package flycheck-rust
:ensure t
:hook
(flycheck-mode-hook .
flycheck-rust-setup))

 

Here, we load the mode for Rust development. Auto-indent with spaces, run rustfmt on save (needs to be installed via rustup. Prettify symbols (cause why not), and use language server protocol. I’m binding “M-,” to compile; I know it’s an odd keybinding, but I’m used to it by now. Feel free to make it your own.

In addition to this, I’m hooking flycheck for linting.

Conclusion

IntelliJ made it very easy to set up as well, but that’s a multi-hundred dollar application. If you’re on a budget, Emacs, vim, or VSCode should bet viable options as well.

I’m still getting started with Rust and I don’t know how much it will stick, since I’ve been writing Go for a number of years; but I’m happy I have a familiar environment to get started from. By now I should know Emacs should always be my first option.

  • Archives

    • August 2026
    • June 2024
    • May 2024
    • December 2023
    • November 2023
    • January 2022
    • February 2021
    • August 2020
    • June 2020
    • December 2019
    • June 2019
    • April 2019
    • January 2019
    • July 2013
    • June 2013
    • May 2013
    • March 2013
  • Categories

    • 911
    • AI
    • Aviation
    • Business
    • Emacs
    • Life
    • Photography
    • Public Safety
    • Tech
    • Uncategorized
© 2026, Ismael Arenzana. All rights reserved.
This site uses cookies. By continuing to browse the site, you are agreeing to our use of cookies.
OK Learn More