rustfmt
Chester Wyke September 02, 2023 Updated: April 15, 2025 #rust
rust (Series)
Conditional Compilation
Install
Crate Serde
References
Cargo
Toolchain (Nightly)
String Formatting
Time
Crate Tokio
Publish Crate
rustfmt
Single file script
Snippets
CI
Pattern Type State
WASM
Create New Crate
Documentation
JSON
Pattern Builder
Testing
Working with collections of bytes
Thoughts about rust
Are we yet
OnceLock
Crate Actix Web
Stack Overflow
Crate Clap
Crate Poll Promise
Crate Insta
Tips
Create new egui project
Crate CSV
Crate egui
Iterators
Crate Tracing Subscriber
Regex
vscode
Enum Conversion
Macros
lettre
Google APIs
Conditional Compilation
Install
Crate Serde
References
Cargo
Toolchain (Nightly)
String Formatting
Time
Crate Tokio
Publish Crate
rustfmt
Single file script
Snippets
CI
Pattern Type State
WASM
Create New Crate
Documentation
JSON
Pattern Builder
Testing
Working with collections of bytes
Thoughts about rust
Are we yet
OnceLock
Crate Actix Web
Stack Overflow
Crate Clap
Crate Poll Promise
Crate Insta
Tips
Create new egui project
Crate CSV
Crate egui
Iterators
Crate Tracing Subscriber
Regex
vscode
Enum Conversion
Macros
lettre
Google APIs
Run rustfmt using nightly compiler
This might be needed if you want to use nighty only features
To format specific file
Does the whole file plus any files included in it like the rest of the library in this example
To format all binary and library targets of your crate
Using comment wrapping (comment_width)
Source: https://rust-lang.github.io/rustfmt/#comment_width
Needs this setting in the rustfmt.toml
and must be uncommented to use but must tay commented when using the normal stable compiler as it hasn’t been standardized as yet.
# `wrap_comments` is unstable so to use you need to use nightly.
# Uncomment the line below then run `cargo +nightly fmt`
# wrap_comments = true