Apply updated needless_raw_strings to Clippy sources
This commit is contained in:
parent
5e78c15caa
commit
36c31db705
@ -207,13 +207,13 @@ fn parse_manifest(contents: &str) -> Option<String> {
|
|||||||
|
|
||||||
fn get_test_file_contents(lint_name: &str, msrv: bool) -> String {
|
fn get_test_file_contents(lint_name: &str, msrv: bool) -> String {
|
||||||
let mut test = formatdoc!(
|
let mut test = formatdoc!(
|
||||||
r#"
|
r"
|
||||||
#![warn(clippy::{lint_name})]
|
#![warn(clippy::{lint_name})]
|
||||||
|
|
||||||
fn main() {{
|
fn main() {{
|
||||||
// test code goes here
|
// test code goes here
|
||||||
}}
|
}}
|
||||||
"#
|
"
|
||||||
);
|
);
|
||||||
|
|
||||||
if msrv {
|
if msrv {
|
||||||
@ -272,23 +272,23 @@ fn get_lint_file_contents(lint: &LintData<'_>, enable_msrv: bool) -> String {
|
|||||||
|
|
||||||
result.push_str(&if enable_msrv {
|
result.push_str(&if enable_msrv {
|
||||||
formatdoc!(
|
formatdoc!(
|
||||||
r#"
|
r"
|
||||||
use clippy_config::msrvs::{{self, Msrv}};
|
use clippy_config::msrvs::{{self, Msrv}};
|
||||||
use clippy_config::Conf;
|
use clippy_config::Conf;
|
||||||
{pass_import}
|
{pass_import}
|
||||||
use rustc_lint::{{{context_import}, {pass_type}, LintContext}};
|
use rustc_lint::{{{context_import}, {pass_type}, LintContext}};
|
||||||
use rustc_session::impl_lint_pass;
|
use rustc_session::impl_lint_pass;
|
||||||
|
|
||||||
"#
|
"
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
formatdoc!(
|
formatdoc!(
|
||||||
r#"
|
r"
|
||||||
{pass_import}
|
{pass_import}
|
||||||
use rustc_lint::{{{context_import}, {pass_type}}};
|
use rustc_lint::{{{context_import}, {pass_type}}};
|
||||||
use rustc_session::declare_lint_pass;
|
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 {
|
result.push_str(&if enable_msrv {
|
||||||
formatdoc!(
|
formatdoc!(
|
||||||
r#"
|
r"
|
||||||
pub struct {name_camel} {{
|
pub struct {name_camel} {{
|
||||||
msrv: Msrv,
|
msrv: Msrv,
|
||||||
}}
|
}}
|
||||||
@ -315,15 +315,15 @@ impl {pass_type}{pass_lifetimes} for {name_camel} {{
|
|||||||
|
|
||||||
// TODO: Add MSRV level to `clippy_config/src/msrvs.rs` if needed.
|
// TODO: Add MSRV level to `clippy_config/src/msrvs.rs` if needed.
|
||||||
// TODO: Update msrv config comment in `clippy_config/src/conf.rs`
|
// TODO: Update msrv config comment in `clippy_config/src/conf.rs`
|
||||||
"#
|
"
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
formatdoc!(
|
formatdoc!(
|
||||||
r#"
|
r"
|
||||||
declare_lint_pass!({name_camel} => [{name_upper}]);
|
declare_lint_pass!({name_camel} => [{name_upper}]);
|
||||||
|
|
||||||
impl {pass_type}{pass_lifetimes} for {name_camel} {{}}
|
impl {pass_type}{pass_lifetimes} for {name_camel} {{}}
|
||||||
"#
|
"
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -416,7 +416,7 @@ pub(super) fn check(cx: &{context_import}{pass_lifetimes}, msrv: &Msrv) {{
|
|||||||
} else {
|
} else {
|
||||||
let _: fmt::Result = writedoc!(
|
let _: fmt::Result = writedoc!(
|
||||||
lint_file_contents,
|
lint_file_contents,
|
||||||
r#"
|
r"
|
||||||
use rustc_lint::{{{context_import}, LintContext}};
|
use rustc_lint::{{{context_import}, LintContext}};
|
||||||
|
|
||||||
use super::{name_upper};
|
use super::{name_upper};
|
||||||
@ -425,7 +425,7 @@ pub(super) fn check(cx: &{context_import}{pass_lifetimes}, msrv: &Msrv) {{
|
|||||||
pub(super) fn check(cx: &{context_import}{pass_lifetimes}) {{
|
pub(super) fn check(cx: &{context_import}{pass_lifetimes}) {{
|
||||||
todo!();
|
todo!();
|
||||||
}}
|
}}
|
||||||
"#
|
"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,11 +65,11 @@ fn check_expr(&mut self, cx: &LateContext<'_>, expr: &Expr<'_>) {
|
|||||||
|
|
||||||
fn loop_init_suggestion(elem: &str, len: &str, indent: &str) -> String {
|
fn loop_init_suggestion(elem: &str, len: &str, indent: &str) -> String {
|
||||||
format!(
|
format!(
|
||||||
r#"{{
|
r"{{
|
||||||
{indent} let mut v = Vec::with_capacity({len});
|
{indent} let mut v = Vec::with_capacity({len});
|
||||||
{indent} (0..{len}).for_each(|_| v.push({elem}));
|
{indent} (0..{len}).for_each(|_| v.push({elem}));
|
||||||
{indent} v
|
{indent} v
|
||||||
{indent}}}"#
|
{indent}}}"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ fn print_lint_warnings(lint: &LintWarnings, truncate_after: usize) {
|
|||||||
println!();
|
println!();
|
||||||
|
|
||||||
print!(
|
print!(
|
||||||
r##"{}, {}, {}"##,
|
r"{}, {}, {}",
|
||||||
count_string(name, "added", lint.added.len()),
|
count_string(name, "added", lint.added.len()),
|
||||||
count_string(name, "removed", lint.removed.len()),
|
count_string(name, "removed", lint.removed.len()),
|
||||||
count_string(name, "changed", lint.changed.len()),
|
count_string(name, "changed", lint.changed.len()),
|
||||||
|
@ -20,7 +20,7 @@ fn book() {
|
|||||||
|
|
||||||
let configs = metadata().map(|conf| conf.to_markdown_paragraph()).join("\n");
|
let configs = metadata().map(|conf| conf.to_markdown_paragraph()).join("\n");
|
||||||
let expected = format!(
|
let expected = format!(
|
||||||
r#"<!--
|
r"<!--
|
||||||
This file is generated by `cargo bless --test config-metadata`.
|
This file is generated by `cargo bless --test config-metadata`.
|
||||||
Please use that command to update the file and do not edit it by hand.
|
Please use that command to update the file and do not edit it by hand.
|
||||||
-->
|
-->
|
||||||
@ -33,7 +33,7 @@ fn book() {
|
|||||||
---
|
---
|
||||||
|
|
||||||
{}
|
{}
|
||||||
"#,
|
",
|
||||||
configs.trim(),
|
configs.trim(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user