Also apply warn(for_loops_over_fallibles)
to &T and &mut T, not just T = Result/Option.
This commit is contained in:
parent
ade234d574
commit
4be041a2cd
1 changed files with 9 additions and 1 deletions
|
@ -52,7 +52,15 @@ impl<'tcx> LateLintPass<'tcx> for ForLoopsOverFallibles {
|
|||
|
||||
let ty = cx.typeck_results().expr_ty(arg);
|
||||
|
||||
let &ty::Adt(adt, args) = ty.kind() else { return };
|
||||
// let &ty::Adt(adt, args) = ty.kind() else { return };
|
||||
let (adt, args, _) = match ty.kind() {
|
||||
&ty::Adt(adt, args) => (adt, args, None),
|
||||
&ty::Ref(_, ty, mutability) => match ty.kind() {
|
||||
&ty::Adt(adt, args) => (adt, args, Some(mutability)),
|
||||
_ => return,
|
||||
},
|
||||
_ => return,
|
||||
};
|
||||
|
||||
let (article, ty, var) = match adt.did() {
|
||||
did if cx.tcx.is_diagnostic_item(sym::Option, did) => ("an", "Option", "Some"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue