mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 15:14:29 +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,10 +154,14 @@ fn check_local<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, local: &'tcx Local<'_>, bin
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_binding(cx: &LateContext<'_, '_>, pat_id: HirId) -> bool {
|
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);
|
||||||
match var_ty.kind {
|
if let Some(var_ty) = var_ty {
|
||||||
ty::Adt(..) => false,
|
match var_ty.kind {
|
||||||
_ => true,
|
ty::Adt(..) => false,
|
||||||
|
_ => true,
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
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