Skip to content

Commit ae25efb

Browse files
Fix panic by setting the span before it is actually needed
1 parent dbb159a commit ae25efb

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

clippy_utils/src/diagnostics.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,9 +250,11 @@ where
250250
}
251251
}
252252

253+
let sp = sp.into();
253254
#[expect(clippy::disallowed_methods)]
254-
cx.emit_span_lint(lint, sp, ClippyDiag(|diag: &mut Diag<'_, ()>| {
255+
cx.emit_span_lint(lint, sp.clone(), ClippyDiag(|diag: &mut Diag<'_, ()>| {
255256
diag.primary_message(msg);
257+
diag.span(sp);
256258
f(diag);
257259
docs_link(diag, lint);
258260

0 commit comments

Comments
 (0)