rustfmt Compatible Rust 2021/2024 Beautifier, Minifier & Execution Console

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.

Load Preset Template:
Indent Size:
Indent Type:
Rust Edition Standard:
Brace Style:
Input Rust Source Code
0 chars
0 chars
Rust Structure Valid: No syntax errors detected.
Valid Rust 2021/2024
Lines:0|Input Chars:0|Output Chars:0|Byte Size:0 B|Modules & Use:0|Structs & Enums:0|Traits & Impls:0|Functions & Async Def:0|Attributes & Macros:0|Docstrings & Comments:0
rustfmt & 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.