mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 13:13:34 +00:00
Use node_type_opt
over node_type
This commit is contained in:
parent
187bbf0e7b
commit
8d2a3e0a61
2 changed files with 14 additions and 4 deletions
|
@ -154,11 +154,15 @@ fn check_local<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, local: &'tcx Local<'_>, bin
|
|||
}
|
||||
|
||||
fn is_binding(cx: &LateContext<'_, '_>, pat_id: HirId) -> bool {
|
||||
let var_ty = cx.tables.node_type(pat_id);
|
||||
let var_ty = cx.tables.node_type_opt(pat_id);
|
||||
if let Some(var_ty) = var_ty {
|
||||
match var_ty.kind {
|
||||
ty::Adt(..) => false,
|
||||
_ => true,
|
||||
}
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
fn check_pat<'a, 'tcx>(
|
||||
|
|
6
tests/ui/crashes/shadow.rs
Normal file
6
tests/ui/crashes/shadow.rs
Normal file
|
@ -0,0 +1,6 @@
|
|||
fn main() {
|
||||
let x: [i32; {
|
||||
let u = 2;
|
||||
4
|
||||
}] = [2; { 4 }];
|
||||
}
|
Loading…
Reference in a new issue