Files
doomemacs/modules/lang/rust
Henrik Lissner fc7b179e6c bump: :lang
Wilfred/helpful@5ad8a9ce57 -> Wilfred/helpful@6a4d5e0760
agda/agda@10a0ca0516 -> agda/agda@49a12eab7f
clojure-emacs/cider@a0d6169026 -> clojure-emacs/cider@fdfa7c2200
dominikh/go-mode.el@602d73e226 -> dominikh/go-mode.el@0ed3c5227e
emacs-geiser/gauche@8ff743f641 -> emacs-geiser/gauche@9eb8b35f0c
emacs-lsp/lsp-dart@7e3d342941 -> emacs-lsp/lsp-dart@2170823139
emacs-lsp/lsp-java@868600bf7f -> emacs-lsp/lsp-java@6cfff8761e
emacs-lsp/lsp-metals@567089f7f4 -> emacs-lsp/lsp-metals@345b4fa80e
emacs-lsp/lsp-sourcekit@63ff1ab638 -> emacs-lsp/lsp-sourcekit@3bd9750e7e
emacs-lsp/lsp-treemacs@fb1a07ae0a -> emacs-lsp/lsp-treemacs@312dee2b3a
emacs-rustic/rustic@fbbf0a7192 -> emacs-rustic/rustic@22a5ef8bfd
emacs-straight/auctex@53f80ba36c -> emacs-straight/auctex@6fb366064c
emacs-straight/csv-mode@6979fc18eb -> emacs-straight/csv-mode@1695ee1752
emacsorphanage/dart-mode@88b6683f43 -> emacsorphanage/dart-mode@6229941ec5
erlang/otp@64185e73b0 -> erlang/otp@740af6bae5
fsharp/emacs-fsharp-mode@677d78c4d6 -> fsharp/emacs-fsharp-mode@bf7a11e1ba
gcv/julia-snail@24f79a067b -> gcv/julia-snail@cacf52e4c8
godotengine/emacs-gdscript-mode@c3d9988984 -> godotengine/emacs-gdscript-mode@3f3739dd88
greghendershott/racket-mode@eef5e9ab2c -> greghendershott/racket-mode@88d82e249e
jrblevin/markdown-mode@ee9d6de1d2 -> jrblevin/markdown-mode@d2d960bec1
json-emacs/json-mode@77125b01c0 -> json-emacs/json-mode@466d5b5637
ledger/ledger-mode@356d8049ed -> ledger/ledger-mode@d9b6648201
rust-lang/rust-mode@542f1755d8 -> rust-lang/rust-mode@efd830806c
seagle0128/grip-mode@ffce7f78eb -> seagle0128/grip-mode@e90e3b47d8
ziglang/zig-mode@f0b4a48753 -> ziglang/zig-mode@4ad4edf759
2025-04-01 03:49:02 -04:00
..
2024-09-14 20:47:39 -04:00
2024-10-20 02:41:50 -04:00
2025-04-01 03:49:02 -04:00

:lang rust

Description   unfold

This module adds support for the Rust language and integration for its tools, e.g. cargo.

Maintainers

Module flags

+lsp
Enable LSP support for rustic-mode. Requires doom-module::tools lsp and a langserver (supports rust-analyzer and rls).
+tree-sitter
Leverages tree-sitter for better syntax highlighting and structural text editing. Requires doom-module::tools tree-sitter.

Hacks

  • rustic has been modified not to automatically install lsp-mode or eglot if they're missing. Doom expects you to have enabled the doom-module::tools lsp module yourself.

TODO Changelog

This module does not have a changelog yet.

Installation

Enable this module in your doom! block.

This module requires a working installation of Rust for its more advanced features, and offer only syntax highlighting otherwise. The simplest way to install it is through rustup:

$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# And can be updated later with:
$ rustup update --no-self-update

To install and manage Rust on Windows, consult Rust's official documentation.

󰐃 Once installed, I recommended that you add Cargo's executable to your $PATH, so that the Emacs utilities that depend on it or any tools installed through it can easily locate them (without any added configuration on your part).

Also, if you have used $ doom env in the past, changes to your $PATH won't be visible to Doom until you run it (or $ doom sync) again.

Other Requirements

  • If doom-module::editor format is enabled, you'll need rustfmt: $ rustup component add rustfmt.
  • Users with doom-module:+lsp enabled will need rust-analyzer (rls is supported, but deprecated).
  • Using the following commands requires:

    • cargo-process-check: $ cargo install cargo-check
    • cargo-process-clippy: $ rustup component add clippy-preview

TODO Usage

󱌣 This module's usage documentation is incomplete. Complete it?

LSP support (rust-analyzer)

This module supports rust-analyzer (RLS too, but it is deprecated), which must be installed outside of Emacs, typically with rustup or your OS package manager.

Installation through rustup is simplest:

$ rustup component add rust-analyzer rust-src

If your needs are more complex, consult rust-analyzer's documentation.

Finally, enable Doom's doom-module::tools lsp module, and this module's doom-module:+lsp flag (how to enable modules and their flags), and you're good to go!

Format on save

Enable doom-module::editor format +onsave to get formatting on save with rustfmt. No additional configuration is necessary.

Keybinds

Binding Description
<localleader> b a cargo audit
<localleader> b b cargo build
<localleader> b B cargo bench
<localleader> b c cargo check
<localleader> b C cargo clippy
<localleader> b d cargo doc
<localleader> b n cargo update
<localleader> b o cargo outdated
<localleader> b r cargo run
<localleader> t a cargo test
<localleader> t t run current test

TODO Configuration

󱌣 This module's configuration documentation is incomplete. Complete it?

Enabling eglot support for Rust

Doom's doom-module::tools lsp module has an doom-module:+eglot flag. Enable it and this module will use eglot instead.

Troubleshooting

Report an issue?

error[E0670]: `async fn` is not permitted in the 2015 edition

You may be seeing this error, despite having edition = "2018" in your Cargo.toml. This error actually originates from rustfmt, which the LSP server tries to invoke on save (if you have rustic-format-trigger or [[doom-module::editor format]] enabled).

To fix this your project needs a rustfmt.toml with edition = "2018" in it.

Frequently asked questions

This module has no FAQs yet. Ask one?

TODO Appendix

󱌣 This module has no appendix yet. Write one?