diff options
| author | Samuel Moelius <sam@moeli.us> | 2025-01-14 06:06:06 -0500 |
|---|---|---|
| committer | Samuel Moelius <sam@moeli.us> | 2025-01-14 06:06:06 -0500 |
| commit | 87f7e21009b18a49f306ceb30aca2ef94571ff03 (patch) | |
| tree | fceccd096dff91d7c055ddc31b53938fe1c1a2cc /clippy_dev/src | |
| parent | a7adb8217ebe1d92e9406f846834f9c57246b449 (diff) | |
| download | rust-87f7e21009b18a49f306ceb30aca2ef94571ff03.tar.gz rust-87f7e21009b18a49f306ceb30aca2ef94571ff03.zip | |
Address review comments
Diffstat (limited to 'clippy_dev/src')
| -rw-r--r-- | clippy_dev/src/new_lint.rs | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/clippy_dev/src/new_lint.rs b/clippy_dev/src/new_lint.rs index 7328ee1ac4f..cc4b26867a2 100644 --- a/clippy_dev/src/new_lint.rs +++ b/clippy_dev/src/new_lint.rs @@ -255,9 +255,9 @@ fn get_lint_file_contents(lint: &LintData<'_>, enable_msrv: bool) -> String { let name_camel = to_camel_case(lint.name); let name_upper = lint_name.to_uppercase(); - #[expect(clippy::format_push_string)] - result.push_str(&if enable_msrv { - formatdoc!( + if enable_msrv { + let _: fmt::Result = writedoc!( + result, r" use clippy_utils::msrvs::{{self, Msrv}}; use clippy_config::Conf; @@ -266,23 +266,24 @@ fn get_lint_file_contents(lint: &LintData<'_>, enable_msrv: bool) -> String { use rustc_session::impl_lint_pass; " - ) + ); } else { - formatdoc!( + let _: fmt::Result = writedoc!( + result, r" {pass_import} use rustc_lint::{{{context_import}, {pass_type}}}; use rustc_session::declare_lint_pass; " - ) - }); + ); + } let _: fmt::Result = writeln!(result, "{}", get_lint_declaration(&name_upper, category)); - #[expect(clippy::format_push_string)] - result.push_str(&if enable_msrv { - formatdoc!( + if enable_msrv { + let _: fmt::Result = writedoc!( + result, r" pub struct {name_camel} {{ msrv: Msrv, @@ -303,16 +304,17 @@ fn get_lint_file_contents(lint: &LintData<'_>, enable_msrv: bool) -> String { // TODO: Add MSRV level to `clippy_config/src/msrvs.rs` if needed. // TODO: Update msrv config comment in `clippy_config/src/conf.rs` " - ) + ); } else { - formatdoc!( + let _: fmt::Result = writedoc!( + result, r" declare_lint_pass!({name_camel} => [{name_upper}]); impl {pass_type}{pass_lifetimes} for {name_camel} {{}} " - ) - }); + ); + } result } |
