How to do it...

Follow the steps to implement this recipe:

  1. Open the main.rs file in the src directory in your preferred text editor.
  2. 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
//-- #########################
  1. Define the main function with some random spacing and style:
        fn main() {
println!("Hello, world!");
}
  1. 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:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.135.247.181