for_loop_over_fallibles
: remove duplication from the message
This commit is contained in:
parent
b2975ee974
commit
dd842ffc3d
1 changed files with 1 additions and 3 deletions
|
@ -69,10 +69,8 @@ impl<'tcx> LateLintPass<'tcx> for ForLoopOverFallibles {
|
||||||
_ => return,
|
_ => return,
|
||||||
};
|
};
|
||||||
|
|
||||||
let Ok(arg_snip) = cx.sess().source_map().span_to_snippet(arg.span) else { return };
|
|
||||||
|
|
||||||
let msg = format!(
|
let msg = format!(
|
||||||
"for loop over `{arg_snip}`, which is {article} `{ty}`. This is more readably written as an `if let` statement",
|
"for loop over {article} `{ty}`. This is more readably written as an `if let` statement",
|
||||||
);
|
);
|
||||||
|
|
||||||
cx.struct_span_lint(FOR_LOOP_OVER_FALLIBLES, arg.span, |diag| {
|
cx.struct_span_lint(FOR_LOOP_OVER_FALLIBLES, arg.span, |diag| {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue