Skip to content

Commit d517ae6

Browse files
Rollup merge of rust-lang#118727 - compiler-errors:lint-decorate, r=WaffleLapkin
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
2 parents d47b7bb + 677ccca commit d517ae6

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

Diff for: clippy_utils/src/diagnostics.rs

-6
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ pub fn span_lint<T: LintContext>(cx: &T, lint: &'static Lint, sp: impl Into<Mult
4949
#[expect(clippy::disallowed_methods)]
5050
cx.struct_span_lint(lint, sp, msg.to_string(), |diag| {
5151
docs_link(diag, lint);
52-
diag
5352
});
5453
}
5554

@@ -90,7 +89,6 @@ pub fn span_lint_and_help<T: LintContext>(
9089
diag.help(help.to_string());
9190
}
9291
docs_link(diag, lint);
93-
diag
9492
});
9593
}
9694

@@ -134,7 +132,6 @@ pub fn span_lint_and_note<T: LintContext>(
134132
diag.note(note);
135133
}
136134
docs_link(diag, lint);
137-
diag
138135
});
139136
}
140137

@@ -152,15 +149,13 @@ where
152149
cx.struct_span_lint(lint, sp, msg.to_string(), |diag| {
153150
f(diag);
154151
docs_link(diag, lint);
155-
diag
156152
});
157153
}
158154

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

@@ -176,7 +171,6 @@ pub fn span_lint_hir_and_then(
176171
cx.tcx.struct_span_lint_hir(lint, hir_id, sp, msg.to_string(), |diag| {
177172
f(diag);
178173
docs_link(diag, lint);
179-
diag
180174
});
181175
}
182176

0 commit comments

Comments
 (0)