Follow the steps to implement this recipe:
- Open the main.rs file in the src directory in your preferred text editor.
- Write the code header with the relevant information, but the catch here is that we purposefully impose incorrect indentations:
//-- #########################
//-- Task: Testing cargo fmt features
//-- Author: Vigneshwer.D
//-- Version: 1.0.0
//-- Date: 04 May 17
//-- #########################
- Define the main function with some random spacing and style:
fn main() {
println!("Hello, world!");
}
- Now, run rustfmt to fix the style issues of the code:
cargo fmt
You should get the following output on successfully executing the preceding code: