Skip to content

Commit

Permalink
Rollup merge of rust-lang#118727 - compiler-errors:lint-decorate, r=W…
Browse files Browse the repository at this point in the history
…affleLapkin

Don't pass lint back out of lint decorator

Change the decorator function in the signature of the `emit_lint`/`span_lint`/etc family of methods from `impl for<'a, 'b> FnOnce(&'b mut DiagnosticBuilder<'a, ()>) -> &'b mut DiagnosticBuilder<'a, ()>` to `impl for<'a, 'b> FnOnce(&'b mut DiagnosticBuilder<'a, ()>)`. I consider it easier to read this way, especially when there's control flow involved.

r? nnethercote though feel free to reassign
  • Loading branch information
workingjubilee authored Dec 15, 2023
2 parents d47b7bb + 677ccca commit d517ae6
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions clippy_utils/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ pub fn span_lint<T: LintContext>(cx: &T, lint: &'static Lint, sp: impl Into<Mult
#[expect(clippy::disallowed_methods)]
cx.struct_span_lint(lint, sp, msg.to_string(), |diag| {
docs_link(diag, lint);
diag
});
}

Expand Down Expand Up @@ -90,7 +89,6 @@ pub fn span_lint_and_help<T: LintContext>(
diag.help(help.to_string());
}
docs_link(diag, lint);
diag
});
}

Expand Down Expand Up @@ -134,7 +132,6 @@ pub fn span_lint_and_note<T: LintContext>(
diag.note(note);
}
docs_link(diag, lint);
diag
});
}

Expand All @@ -152,15 +149,13 @@ where
cx.struct_span_lint(lint, sp, msg.to_string(), |diag| {
f(diag);
docs_link(diag, lint);
diag
});
}

pub fn span_lint_hir(cx: &LateContext<'_>, lint: &'static Lint, hir_id: HirId, sp: Span, msg: &str) {
#[expect(clippy::disallowed_methods)]
cx.tcx.struct_span_lint_hir(lint, hir_id, sp, msg.to_string(), |diag| {
docs_link(diag, lint);
diag
});
}

Expand All @@ -176,7 +171,6 @@ pub fn span_lint_hir_and_then(
cx.tcx.struct_span_lint_hir(lint, hir_id, sp, msg.to_string(), |diag| {
f(diag);
docs_link(diag, lint);
diag
});
}

Expand Down

0 comments on commit d517ae6

Please sign in to comment.