doomemacs/modules/lang/rust/README.org
Sean Escriva f62723644f
Fix install command for clippy, uses rustup
Trying to install with cargo fails with the following error:

```
Caused by:
  failed to run custom build command for `clippy v0.0.302`

Caused by:
  process didn't exit successfully: `/var/folders/66/180ynjt55z74l338gh0stq0c0000gn/T/cargo-installkNqJBB/release/build/clippy-bcde765a4c9acf93/build-script-build` (exit code: 1)
--- stderr

error: Clippy is no longer available via crates.io

help: please run `rustup component add clippy-preview` instead
```
2019-09-27 14:39:17 -04:00

85 lines
3 KiB
Org Mode

#+TITLE: lang/rust
#+DATE: June 5, 2019
#+SINCE: {replace with next tagged release version}
#+STARTUP: inlineimages
* Table of Contents :TOC_3:noexport:
- [[#description][Description]]
- [[#module-flags][Module Flags]]
- [[#plugins][Plugins]]
- [[#hacks][Hacks]]
- [[#prerequisites][Prerequisites]]
- [[#features][Features]]
- [[#configuration][Configuration]]
- [[#troubleshooting][Troubleshooting]]
- [[#racer-installation-problems][Racer installation problems]]
* Description
Add support to Rust language and cargo commands inside emacs.
+ Code completion (~racer~)
+ Syntax checking (~flycheck~)
+ Snippets
** Module Flags
+ ~+lsp~ to add support Language server protocol.
** Plugins
+ [[https://github.com/rust-lang/rust-mode][Rust-mode]]
+ [[https://github.com/racer-rust/emacs-racer][Racer-mode]]
+ [[https://github.com/racer-rust/emacs-racer][Cargo-mode]]
** Hacks
{A list of internal modifications to included packages}
* Prerequisites
To get started with Rust, you can either use =rustup= and install rust with:
~curl https://sh.rustup.rs -sSf | sh~
Package manager is not recommended to install Nightly version of Rust what is
required for ~racer~ from [[https://github.com/racer-rust/racer#installation][version 2.1]] (more info in [[#Troubleshooting][Troubleshooting]])
Some features have additional dependencies:
+ The ~:editor format~ module uses ~rustfmt~ for rust files: ~rustup component
add rustfmt-preview~
+ The following commands require:
+ ~cargo-process-check~: ~cargo install cargo-check~
+ ~cargo-process-clippy~: ~rustup component add clippy-preview~
+ ~cargo-process-{add,rm,upgrade}~: ~cargo install cargo-edit~
* Features
This module also supports LSP, it requires installation of Rust Language Server
[[https://github.com/rust-lang/rls][~RLS~]]. To enable this you need to enable ~lsp~ in ~:tools~ section in ~init.el~ file.
Keybindings
| Binding | Description |
|---------------------+-----------------------------|
| ~<localleader> b a~ | ~cargo add~ |
| ~<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 r~ | ~cargo run~ |
| ~<localleader> b s~ | ~cargo search~ |
| ~<localleader> b u~ | ~cargo update~ |
| ~<localleader> t a~ | ~cargo test~ |
| ~<localleader> t f~ | ~run tests in current file~ |
| ~<localleader> t t~ | ~run current test~ |
* TODO Configuration
How to configure this module, including common problems and how to address them.
* Troubleshooting
** Racer installation problems
Racer need now ([[https://github.com/racer-rust/racer#installation][From 2.1 version]]) nightly version of Rust
If you installed trough rustup
#+BEGIN_SRC sh
rustup toolchain add nightly
cargo +nightly install racer
#+END_SRC