Skip to content

Commit 3f01ca0

Browse files
Rollup merge of #151302 - add-lint-test, r=lqd
add lint test closes #138069, which was already fixed.
2 parents a56e2d3 + 3a8b577 commit 3f01ca0

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

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

0 commit comments

Comments
 (0)