Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1daabc3

Browse files
review02
1 parent 3263ad9 commit 1daabc3

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

‎examples/closures.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
fn main() {
3+
let f = |x| x*x;
4+
let res = f(10);
5+
println!("res {}", res);
6+
}

‎examples/matching.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11

2-
3-
4-
5-
62
struct Point {
73
x: f32,
84
y: f32
@@ -29,8 +25,19 @@ fn main() {
2925

3026
match_tuple((1, "wasdf".to_string()));
3127

28+
// if let sentences
29+
3230
let ot = Some((2, "hello".to_string()));
33-
if let Some((_, ref s)) = ot {
31+
if let Some((1, ref s)) = ot {
3432
println!("{}", s);
33+
} else {
34+
println!("no match");
3535
}
36+
37+
if let Ok(n) = "42".parse::<i32>() {
38+
println!("n is {}", n);
39+
}
40+
41+
let n: i32 = "44".parse().unwrap();
42+
println!("n is {}", n);
3643
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /