Search⌘ K
AI Features

Layout

Explore Rust's layout principles to write clean and readable code by following indentation and spacing guidelines. Understand why formatting matters for programmers and learn to use tools like Rustfmt to maintain consistent code style. Practice fixing poorly formatted code to enhance your Rust programming clarity.

We'll cover the following...

Look at this ...

Rust 1.40.0
fn main() {
println!("Hello, world!");
{
let name = "Michael";
println!("Nice to meet you, {}!", name);
}
println!("Have a great day");
}

Now compare it to this one:

Rust 1.40.0
fn main(){println!("Hello, world!"
)
;{
let name = "Michael"; println!(
"Nice to meet you, {}!", name
);
} println!("Have a great day")
; }

These ...