Skip to content

Commit 7803d8b

Browse files
committed
Use 'a' article for &Option.
1 parent 0e46759 commit 7803d8b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

compiler/rustc_lint/src/for_loops_over_fallibles.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ impl<'tcx> LateLintPass<'tcx> for ForLoopsOverFallibles {
6262
};
6363

6464
let (article, ty, var) = match adt.did() {
65-
did if cx.tcx.is_diagnostic_item(sym::Option, did) => ("an", "Option", "Some"),
65+
did if cx.tcx.is_diagnostic_item(sym::Option, did) && ref_mutability.is_some() => ("an", "Option", "Some"),
66+
did if cx.tcx.is_diagnostic_item(sym::Option, did) => ("a", "Option", "Some"),
6667
did if cx.tcx.is_diagnostic_item(sym::Result, did) => ("a", "Result", "Ok"),
6768
_ => return,
6869
};

0 commit comments

Comments
 (0)