rustfmt
Rust for Visual Studio Code
DISCONTINUED
Our great sponsors
- InfluxDB - Access the most powerful time series database as a service
- SonarQube - Static code analysis for 29 languages.
- ONLYOFFICE ONLYOFFICE Docs — document collaboration in your environment
- CodiumAI - TestGPT | Generating meaningful tests for busy devs
rustfmt | Rust for Visual Studio Code | |
---|---|---|
50 | 0 | |
5,146 | 372 | |
2.3% | - | |
8.0 | 0.0 | |
13 days ago | over 6 years ago | |
Rust | TypeScript | |
Apache License 2.0 | - |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
rustfmt
-
Rust Tips and Tricks #PartOne
Rustfmt is a tool that formats Rust code in compliance with style guidelines. Its name precisely reflects its purpose. To install rustfmt, you can run rustup component add rustfmt. Once installed, you can execute cargo fmt to format Rust code in your workspace. If you require further information, you can visit rustfmt’s GitHub repository.
-
What are some good practices when writing rust?
code must be formatted with rustfmt.
-
Hey Rustaceans! Got a question? Ask here (5/2023)!
Yes, some cases are not yet supported (https://github.com/rust-lang/rustfmt/issues/4914).
-
How do I stop RustFmt from turning this…
Just FYI, the let-else suggestions will only work until rustfmt settles on a format for it. So you may be surprised when this happens and it suddenly changes.
-
Hey Rustaceans! Got a question? Ask here! (50/2022)!
rust-analyzer and Clippy aren't not really involved with formatting. rustmft does autoformat to 4 spaces.
-
Hey Rustaceans! Got a question? Ask here! (48/2022)!
rustfmt is the official formatter.
-
Adding formatter and linter to rost_gen
This week, I added a formatter and linter to rost_gen (a static site generator) to improve the readability of the code and fix common issues automatically. I chose to use rustfmt for the formatter and rust-clippy for the linter.
-
Python multi-level break and continue
My example was "twice by one developer", not "twice across all indexed repos."
A spot check shows that quite a few in your link are used specifically to ensure correct handling of Rust multi-level breaks work syntax, like https://github.com/rust-lang/rust-analyzer/blob/master/crate... , https://github.com/rust-lang/rustfmt/blob/master/tests/sourc... , https://github.com/rust-lang/rust/blob/master/src/tools/rust... , https://github.com/rust-lang/rust/blob/master/src/tools/rust... and likely more.
Another is a translation of BASIC code to Rust, using break as a form of goto. https://github.com/coding-horror/basic-computer-games/blob/e...
The example at https://github.com/tokio-rs/mio/blob/master/tests/tcp.rs is a nice one
// Wait for our TCP stream to connect
-
Does Rust not need extra linting and sanitizing tools like C++?
There is clippy for additional lints, rust-analyser has some lints (and refactoring tools) that are not in the compiler, there is rustfmt for formatting code or checking if code is formatted and so on
-
Fixed Stacked Borrows violations in ArrayVec crate
In addition, running rustfmt on existing files often moves comments around in a way that changes their meaming. So just doing this blindly on files that are not prepared for rustfmt is a bad idea. This is not a theoretical concern, I have run into this several times, and sometimes this has slipped through review.
Rust for Visual Studio Code
We haven't tracked posts mentioning Rust for Visual Studio Code yet.
Tracking mentions began in Dec 2020.
What are some alternatives?
intellij-rust - Rust plugin for the IntelliJ Platform
Clippy - A bunch of lints to catch common mistakes and improve your Rust code. Book: https://doc.rust-lang.org/clippy/
rust-analyzer - A Rust compiler front-end for IDEs [Moved to: https://github.com/rust-lang/rust-analyzer]
rust-analyzer - A Rust compiler front-end for IDEs
vscode-rust
Rustup - The Rust toolchain installer
rust-on-raspberry-pi
sublime-rust - The official Sublime Text 3 package for the Rust Programming Language
YouCompleteMe - A code-completion engine for Vim
CodeLLDB - A native debugger extension for VSCode based on LLDB