File tree 1 file changed +4
-4
lines changed
content/lessons/06_closures_iterators 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 1
1
fn main ( ) {
2
2
#[ rustfmt:: skip]
3
3
{
4
- // This is formatted so that with rust-analyzer it renders as well-aligned.
4
+ // This is formatted so that without rust-analyzer it renders as well-aligned.
5
5
6
- fn add_one_v1 ( x : u32 ) -> u32 { x + 1 } // This is an ordinary function.
6
+ fn add_one_v1 ( x : u32 ) -> u32 { x + 1 } // This is an ordinary function.
7
7
let add_one_v2 = |x : u32 | -> u32 { x + 1 } ; // Closures use pipes instead of parentheses.
8
- let add_one_v3 = |x| { x + 1 } ; // Both parameters and return value can have their types inferred.
9
- let add_one_v4 = |x| x + 1 ; // If the body is a single expression, braces can be omitted.
8
+ let add_one_v3 = |x| { x + 1 } ; // Both parameters and return value can have their types inferred.
9
+ let add_one_v4 = |x| x + 1 ; // If the body is a single expression, braces can be omitted.
10
10
11
11
let _res = add_one_v1 ( 0_u32 ) ;
12
12
let _res = add_one_v2 ( 0_u32 ) ;
You can’t perform that action at this time.
0 commit comments