Skip to content

Commit b499b7d

Browse files
committed
test: add test for match as stmt no triggering needless_return
1 parent c12748f commit b499b7d

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

tests/ui/needless_return.fixed

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,4 +307,13 @@ mod issue10049 {
307307
}
308308
}
309309

310+
fn test_match_as_stmt() {
311+
let x = 9;
312+
match x {
313+
1 => 2,
314+
2 => return,
315+
_ => 0,
316+
};
317+
}
318+
310319
fn main() {}

tests/ui/needless_return.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,4 +317,13 @@ mod issue10049 {
317317
}
318318
}
319319

320+
fn test_match_as_stmt() {
321+
let x = 9;
322+
match x {
323+
1 => 2,
324+
2 => return,
325+
_ => 0,
326+
};
327+
}
328+
320329
fn main() {}

0 commit comments

Comments
 (0)