Skip to content

Commit 87f7e21

Browse files
committed
Address review comments
1 parent a7adb82 commit 87f7e21

File tree

2 files changed

+17
-15
lines changed

2 files changed

+17
-15
lines changed

clippy_dev/src/new_lint.rs

+16-14
Original file line numberDiff line numberDiff line change
@@ -255,9 +255,9 @@ fn get_lint_file_contents(lint: &LintData<'_>, enable_msrv: bool) -> String {
255255
let name_camel = to_camel_case(lint.name);
256256
let name_upper = lint_name.to_uppercase();
257257

258-
#[expect(clippy::format_push_string)]
259-
result.push_str(&if enable_msrv {
260-
formatdoc!(
258+
if enable_msrv {
259+
let _: fmt::Result = writedoc!(
260+
result,
261261
r"
262262
use clippy_utils::msrvs::{{self, Msrv}};
263263
use clippy_config::Conf;
@@ -266,23 +266,24 @@ fn get_lint_file_contents(lint: &LintData<'_>, enable_msrv: bool) -> String {
266266
use rustc_session::impl_lint_pass;
267267
268268
"
269-
)
269+
);
270270
} else {
271-
formatdoc!(
271+
let _: fmt::Result = writedoc!(
272+
result,
272273
r"
273274
{pass_import}
274275
use rustc_lint::{{{context_import}, {pass_type}}};
275276
use rustc_session::declare_lint_pass;
276277
277278
"
278-
)
279-
});
279+
);
280+
}
280281

281282
let _: fmt::Result = writeln!(result, "{}", get_lint_declaration(&name_upper, category));
282283

283-
#[expect(clippy::format_push_string)]
284-
result.push_str(&if enable_msrv {
285-
formatdoc!(
284+
if enable_msrv {
285+
let _: fmt::Result = writedoc!(
286+
result,
286287
r"
287288
pub struct {name_camel} {{
288289
msrv: Msrv,
@@ -303,16 +304,17 @@ fn get_lint_file_contents(lint: &LintData<'_>, enable_msrv: bool) -> String {
303304
// TODO: Add MSRV level to `clippy_config/src/msrvs.rs` if needed.
304305
// TODO: Update msrv config comment in `clippy_config/src/conf.rs`
305306
"
306-
)
307+
);
307308
} else {
308-
formatdoc!(
309+
let _: fmt::Result = writedoc!(
310+
result,
309311
r"
310312
declare_lint_pass!({name_camel} => [{name_upper}]);
311313
312314
impl {pass_type}{pass_lifetimes} for {name_camel} {{}}
313315
"
314-
)
315-
});
316+
);
317+
}
316318

317319
result
318320
}

clippy_lints/src/format_push_string.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ declare_clippy_lint! {
1111
/// Detects cases where the result of a `format!` call is
1212
/// appended to an existing `String`.
1313
///
14-
/// ### Why restrict this?
14+
/// ### Why is this bad?
1515
/// Introduces an extra, avoidable heap allocation.
1616
///
1717
/// ### Known problems

0 commit comments

Comments
 (0)