Skip to content

Commit 223cbd2

Browse files
committed
add test for Result
1 parent 8f0d42d commit 223cbd2

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

tests/ui/option_if_let_else.fixed

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,4 +177,14 @@ fn main() {
177177
// issue #8492
178178
let _ = s.map_or(1, |string| string.len());
179179
let _ = Some(10).map_or(5, |a| a + 1);
180+
181+
let res: Result<i32, i32> = Ok(5);
182+
let _ = match res {
183+
Ok(a) => a + 1,
184+
_ => 1,
185+
};
186+
let _ = match res {
187+
Err(_) => 1,
188+
Ok(a) => a + 1,
189+
};
180190
}

tests/ui/option_if_let_else.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,4 +212,14 @@ fn main() {
212212
Some(a) => a + 1,
213213
None => 5,
214214
};
215+
216+
let res: Result<i32, i32> = Ok(5);
217+
let _ = match res {
218+
Ok(a) => a + 1,
219+
_ => 1,
220+
};
221+
let _ = match res {
222+
Err(_) => 1,
223+
Ok(a) => a + 1,
224+
};
215225
}

0 commit comments

Comments
 (0)