What is the recommended indentation?

I use 2 spaces in JavaScript, Ruby and Elixir, and 4 spaces in Go. What's the recommended indentation for Rust?

1 Like

The standard is 4 spaces.

4 Likes

Thank you! :slight_smile:

You may also want to configure your editor to run rustfmt on save. I find it tremendously freeing to never have to think about style again!

3 Likes

Rely on rustfmt for the recommanded styling

3 Likes

It's also worth noting that rustfmt has a corresponding style guide, which defines the default/recommended formatting rules.

2 Likes