Use node_type_opt over node_type

This commit is contained in:
Yuki Okushi 2020-03-10 18:18:34 +09:00
parent 187bbf0e7b
commit 8d2a3e0a61
No known key found for this signature in database
GPG key ID: B0986C85C0E2DAA1
2 changed files with 14 additions and 4 deletions

View file

@ -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
} }
} }

View file

@ -0,0 +1,6 @@
fn main() {
let x: [i32; {
let u = 2;
4
}] = [2; { 4 }];
}