Skip to content

Commit 5be42ca

Browse files
committed
add lint test
closes #138069, add test program
1 parent 621d767 commit 5be42ca

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// #138069: This test ensures that unused_assignments is not incorrectly reported for assignments used within a match expression.
2+
//@ run-pass
3+
4+
fn pnk(x: usize) -> &'static str {
5+
let mut k1 = "k1";
6+
let mut h1 = "h1";
7+
match x & 3 {
8+
3 if { k1 = "unused?"; false } => (),
9+
_ if { h1 = k1; true } => (),
10+
_ => (),
11+
}
12+
h1
13+
}
14+
15+
#[deny(unused_assignments)]
16+
fn main() {
17+
pnk(3);
18+
}

0 commit comments

Comments
 (0)