From 36c31db705031096520976e8134a98df4e44b578 Mon Sep 17 00:00:00 2001 From: Samuel Tardieu Date: Sat, 5 Oct 2024 17:08:04 +0200 Subject: [PATCH] Apply updated needless_raw_strings to Clippy sources --- clippy_dev/src/new_lint.rs | 24 ++++++++++++------------ clippy_lints/src/rc_clone_in_vec_init.rs | 4 ++-- lintcheck/src/json.rs | 2 +- tests/config-metadata.rs | 4 ++-- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/clippy_dev/src/new_lint.rs b/clippy_dev/src/new_lint.rs index c4d9c52a1cc25..8b32dc6b8885f 100644 --- a/clippy_dev/src/new_lint.rs +++ b/clippy_dev/src/new_lint.rs @@ -207,13 +207,13 @@ pub(crate) fn get_stabilization_version() -> String { fn get_test_file_contents(lint_name: &str, msrv: bool) -> String { let mut test = formatdoc!( - r#" + r" #![warn(clippy::{lint_name})] fn main() {{ // test code goes here }} - "# + " ); if msrv { @@ -272,23 +272,23 @@ fn get_lint_file_contents(lint: &LintData<'_>, enable_msrv: bool) -> String { result.push_str(&if enable_msrv { formatdoc!( - r#" + r" use clippy_config::msrvs::{{self, Msrv}}; use clippy_config::Conf; {pass_import} use rustc_lint::{{{context_import}, {pass_type}, LintContext}}; use rustc_session::impl_lint_pass; - "# + " ) } else { formatdoc!( - r#" + r" {pass_import} use rustc_lint::{{{context_import}, {pass_type}}}; use rustc_session::declare_lint_pass; - "# + " ) }); @@ -296,7 +296,7 @@ fn get_lint_file_contents(lint: &LintData<'_>, enable_msrv: bool) -> String { result.push_str(&if enable_msrv { formatdoc!( - r#" + r" pub struct {name_camel} {{ msrv: Msrv, }} @@ -315,15 +315,15 @@ 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!( - r#" + r" declare_lint_pass!({name_camel} => [{name_upper}]); impl {pass_type}{pass_lifetimes} for {name_camel} {{}} - "# + " ) }); @@ -416,7 +416,7 @@ fn create_lint_for_ty(lint: &LintData<'_>, enable_msrv: bool, ty: &str) -> io::R } else { let _: fmt::Result = writedoc!( lint_file_contents, - r#" + r" use rustc_lint::{{{context_import}, LintContext}}; use super::{name_upper}; @@ -425,7 +425,7 @@ fn create_lint_for_ty(lint: &LintData<'_>, enable_msrv: bool, ty: &str) -> io::R pub(super) fn check(cx: &{context_import}{pass_lifetimes}) {{ todo!(); }} - "# + " ); } diff --git a/clippy_lints/src/rc_clone_in_vec_init.rs b/clippy_lints/src/rc_clone_in_vec_init.rs index e877f5d6ed432..6bb7650a7e1cf 100644 --- a/clippy_lints/src/rc_clone_in_vec_init.rs +++ b/clippy_lints/src/rc_clone_in_vec_init.rs @@ -65,11 +65,11 @@ impl LateLintPass<'_> for RcCloneInVecInit { fn loop_init_suggestion(elem: &str, len: &str, indent: &str) -> String { format!( - r#"{{ + r"{{ {indent} let mut v = Vec::with_capacity({len}); {indent} (0..{len}).for_each(|_| v.push({elem})); {indent} v -{indent}}}"# +{indent}}}" ) } diff --git a/lintcheck/src/json.rs b/lintcheck/src/json.rs index ee0c80aea522e..3a68f2c924356 100644 --- a/lintcheck/src/json.rs +++ b/lintcheck/src/json.rs @@ -133,7 +133,7 @@ fn print_lint_warnings(lint: &LintWarnings, truncate_after: usize) { println!(); print!( - r##"{}, {}, {}"##, + r"{}, {}, {}", count_string(name, "added", lint.added.len()), count_string(name, "removed", lint.removed.len()), count_string(name, "changed", lint.changed.len()), diff --git a/tests/config-metadata.rs b/tests/config-metadata.rs index 628dfc8f758ac..af9fe064dc708 100644 --- a/tests/config-metadata.rs +++ b/tests/config-metadata.rs @@ -20,7 +20,7 @@ fn book() { let configs = metadata().map(|conf| conf.to_markdown_paragraph()).join("\n"); let expected = format!( - r#" @@ -33,7 +33,7 @@ and lints affected. --- {} -"#, +", configs.trim(), );