correct scoping for shadow lints
This commit is contained in:
parent
6df102cdab
commit
51a211503d
2 changed files with 12 additions and 1 deletions
|
@ -19,4 +19,12 @@ fn main() {
|
|||
let x = first(x); //~ERROR: x is shadowed by first(x) which reuses
|
||||
let y = 1;
|
||||
let x = y; //~ERROR: x is shadowed by y in this declaration
|
||||
|
||||
let o = Some(1u8);
|
||||
|
||||
if let Some(p) = o { assert_eq!(1, p); }
|
||||
match o {
|
||||
Some(p) => p, // no error, because the p above is in its own scope
|
||||
None => 0,
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue