diff options
| author | Catherine Flores <catherine.3.flores@gmail.com> | 2025-01-28 19:32:24 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-28 19:32:24 +0000 |
| commit | e02c8857e83e9113c29e8bd2b429f62dfaba04a7 (patch) | |
| tree | 30dcdbbb209100f6c7ec644defb6b52c288cbecf /clippy_dev/src | |
| parent | 6a209cdc9045f6770031de0764217081a176aee6 (diff) | |
| parent | 87f7e21009b18a49f306ceb30aca2ef94571ff03 (diff) | |
| download | rust-e02c8857e83e9113c29e8bd2b429f62dfaba04a7.tar.gz rust-e02c8857e83e9113c29e8bd2b429f62dfaba04a7.zip | |
Move `format_push_string` and `format_collect` to pedantic (#13894)
Closes #11434 by moving `format_push_string` and `format_collect` to pedantic. changelog: Move `format_push_string` and `format_collect` to pedantic
Diffstat (limited to 'clippy_dev/src')
| -rw-r--r-- | clippy_dev/src/new_lint.rs | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/clippy_dev/src/new_lint.rs b/clippy_dev/src/new_lint.rs index 35dd986ff61..cc4b26867a2 100644 --- a/clippy_dev/src/new_lint.rs +++ b/clippy_dev/src/new_lint.rs @@ -255,8 +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(); - 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; @@ -265,22 +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)); - result.push_str(&if enable_msrv { - formatdoc!( + if enable_msrv { + let _: fmt::Result = writedoc!( + result, r" pub struct {name_camel} {{ msrv: Msrv, @@ -301,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 } |
