1+ # rust-mode
2+
13[ ![ MELPA] ( https://melpa.org/packages/rust-mode-badge.svg )] ( https://melpa.org/#/rust-mode )
4+ [ ![ ] ( https://github.com/rust-lang/rust-mode/workflows/CI/badge.svg )] ( https://github.com/rust-lang/rust-mode/actions?query=workflow%3ACI )
25
36<!-- markdown-toc start - Don't edit this section. Run M-x markdown-toc-refresh-toc -->
47** Table of Contents**
2326
2427<!-- markdown-toc end -->
2528
26- # Introduction
29+ ## Introduction
2730` rust-mode ` makes editing [ Rust] ( http://rust-lang.org ) code with Emacs
2831enjoyable. It requires Emacs 25 or later, and is included in both
2932[ Emacs Prelude] ( https://github.com/bbatsov/prelude ) and
@@ -39,9 +42,9 @@ trait definitions. See [Auto-completion / code navigation](#auto-completion--cod
3942below for tips on how to enable this.
4043
4144
42- # Installation
45+ ## Installation
4346
44- ## Melpa
47+ ### Melpa
4548The package is available on MELPA. Add this to your init.el.
4649
4750``` elisp
@@ -60,16 +63,16 @@ And put this in your config to load rust-mode automatically:
6063
6164` (require 'rust-mode) `
6265
63- ## Manual installation
66+ ### Manual installation
6467Clone this repository locally, and add this to your init.el:
6568
6669``` elisp
6770(add-to-list 'load-path "/path/to/rust-mode/")
6871(autoload 'rust-mode "rust-mode" nil t)
6972```
7073
71- # Feature guide
72- ## Indentation
74+ ## Feature guide
75+ ### Indentation
7376Commands like <kbd >TAB</kbd > should indent correctly.
7477
7578The Rust style guide recommends spaces rather than tabs for
@@ -81,7 +84,7 @@ which forces indentation to always use spaces.
8184 (lambda () (setq indent-tabs-mode nil)))
8285```
8386
84- ## Code formatting
87+ ### Code formatting
8588
8689The ` rust-format-buffer ` function will format your code with
8790[ rustfmt] ( https://github.com/rust-lang/rustfmt ) if installed. By
@@ -95,7 +98,7 @@ on save:
9598(setq rust-format-on-save t)
9699```
97100
98- ## Running / testing / compiling code
101+ ### Running / testing / compiling code
99102
100103The ` rust-run ` , ` rust-test ` , ` rust-compile ` and ` rust-check ` functions shell out to
101104Cargo to run, test, build and check your code. Under the hood, these use the
@@ -108,21 +111,21 @@ you can use the following in your init.el:
108111(define-key rust-mode-map (kbd "C-c C-c") 'rust-run)
109112```
110113
111- ## Clippy
114+ ### Clippy
112115` rust-run-clippy ` runs
113116[ Clippy] ( https://github.com/rust-lang/rust-clippy ) , a linter.
114117
115- ## Easy insertion of !dbg
118+ ### Easy insertion of !dbg
116119` rust-dbg-wrap-or-unwrap ` either wraps or unwraps the current region
117120in ` dbg! ` . This can be useful for easily adding debug lines to your
118121program.
119122
120123This is bound to <kbd >C-c C-d</kbd > by default.
121124
122125
123- # Other recommended packages
126+ ## Other recommended packages
124127
125- ## Auto-completion / code navigation
128+ ### Auto-completion / code navigation
126129This package does not provide integration with
127130[ RLS] ( https://github.com/rust-lang/rls ) , which provides
128131auto-completion and code navigation. To use this you need an Emacs
@@ -136,26 +139,26 @@ A lighter package that uses
136139[ racer] ( https://github.com/racer-rust/racer ) is
137140[ emacs-racer] ( https://github.com/racer-rust/emacs-racer ) .
138141
139- ## flycheck
142+ ### flycheck
140143[ flycheck] ( https://github.com/flycheck/flycheck ) allows highlighting
141144compile errors and Clippy lints inline.
142145
143- ## cargo.el
146+ ### cargo.el
144147[ cargo.el] ( https://github.com/kwrooijen/cargo.el ) provides a minor
145148mode for integration with Cargo, Rust's package manager.
146149
147- ## cargo-mode
150+ ### cargo-mode
148151
149152[ cargo-mode] ( https://github.com/ayrat555/cargo-mode ) is an Emacs minor mode which allows to dynamically select a Cargo command. The reasons behind this package can be found in [ the post] ( https://www.badykov.com/emacs/2021/05/29/emacs-cargo-mode/ ) .
150153
151- ## Rustic
154+ ### Rustic
152155[ rustic] ( https://github.com/brotzeit/rustic ) is based on rust-mode,
153156extending it with other features such as integration with LSP and with flycheck.
154157
155158
156- # For package maintainers
159+ ## For package maintainers
157160
158- ## Tests
161+ ### Tests
159162
160163Run elisp tests:
161164
0 commit comments