From 66573b70a9b1807337f1980538d524e1dfd2aba1 Mon Sep 17 00:00:00 2001 From: Zachary S Date: Wed, 15 May 2024 12:45:52 -0500 Subject: [PATCH] Use 'a' article for &Option. --- compiler/rustc_lint/src/for_loops_over_fallibles.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/compiler/rustc_lint/src/for_loops_over_fallibles.rs b/compiler/rustc_lint/src/for_loops_over_fallibles.rs index 12a790bb0fa..b05f5e7638b 100644 --- a/compiler/rustc_lint/src/for_loops_over_fallibles.rs +++ b/compiler/rustc_lint/src/for_loops_over_fallibles.rs @@ -62,6 +62,7 @@ impl<'tcx> LateLintPass<'tcx> for ForLoopsOverFallibles { }; let (article, ty, var) = match adt.did() { + did if cx.tcx.is_diagnostic_item(sym::Option, did) && ref_mutability.is_some() => ("a", "Option", "Some"), did if cx.tcx.is_diagnostic_item(sym::Option, did) => ("an", "Option", "Some"), did if cx.tcx.is_diagnostic_item(sym::Result, did) => ("a", "Result", "Ok"), _ => return,