Rust Formatter
Beautify, format, validate, and minify Rust source code with rustfmt compliance, Rust 2021/2024 features (structs, enums, traits, generics, lifetimes, pattern matching, async/await, macros, attributes), document analytics, and safe sandboxed console execution preview.
Input Rust Source Code
0 charsrustfmt & Rust 2021/2024 Formatting Standards & Developer Specification Reference
Rust 2021/2024 Features
Full support for Lifetimes (fn longest<'a>(...) -> &'a str), Generics, Pattern matching (let Some(v) = opt else { return; }), and derive macros.
Security Safeguards
Treats Rust code strictly as text data for formatting. NEVER compiles, builds, or runs Cargo commands on the host machine.
rustfmt 4-Space Standards
Formatted according to official canonical rustfmt standards using 4-space indentation, match arm alignment, and derive macro grouping.
Attributes & Raw Strings
Inner/outer attributes (#[derive(...)], #[cfg(...)]) and raw string literals (r#"raw"#) are preserved verbatim without altering contents.