diff options
| author | xFrednet <xFrednet@gmail.com> | 2024-07-21 11:00:02 +0200 |
|---|---|---|
| committer | xFrednet <xFrednet@gmail.com> | 2024-08-03 10:18:15 +0200 |
| commit | 053210424727ff279515f4b9a7f0cf6e5632acf3 (patch) | |
| tree | cc763c9480e290dc090d9f7f43c12da871eac0e0 /clippy_lints/src/format_push_string.rs | |
| parent | a9d72c7107f45adeead741bdc9f5e1add4a516e2 (diff) | |
Migrating restriction lints to `span_lint_and_then` (e -> i)
Diffstat (limited to 'clippy_lints/src/format_push_string.rs')
| -rw-r--r-- | clippy_lints/src/format_push_string.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/clippy_lints/src/format_push_string.rs b/clippy_lints/src/format_push_string.rs index a75538dd329..d05c5a01f41 100644 --- a/clippy_lints/src/format_push_string.rs +++ b/clippy_lints/src/format_push_string.rs @@ -1,4 +1,4 @@ -use clippy_utils::diagnostics::span_lint_and_help; +use clippy_utils::diagnostics::span_lint_and_then; use clippy_utils::ty::is_type_lang_item; use clippy_utils::{higher, match_def_path, paths}; use rustc_hir::{BinOpKind, Expr, ExprKind, LangItem, MatchSource}; @@ -81,13 +81,15 @@ impl<'tcx> LateLintPass<'tcx> for FormatPushString { _ => return, }; if is_format(cx, arg) { - span_lint_and_help( + #[expect(clippy::collapsible_span_lint_calls, reason = "rust-clippy#7797")] + span_lint_and_then( cx, FORMAT_PUSH_STRING, expr.span, "`format!(..)` appended to existing `String`", - None, - "consider using `write!` to avoid the extra allocation", + |diag| { + diag.help("consider using `write!` to avoid the extra allocation"); + }, ); } } |
