Skip to content

Commit 5ea4771

Browse files
authored
Rollup merge of rust-lang#5412 - dtolnay:tostring, r=flip1995
Downgrade inefficient_to_string to pedantic From the [documentation](https://rust-lang.github.io/rust-clippy/master/index.html#inefficient_to_string): > ```diff > - ["foo", "bar"].iter().map(|s| s.to_string()); > > + ["foo", "bar"].iter().map(|&s| s.to_string()); > ``` I feel like saving 10 nanoseconds from the formatting machinery isn't worth asking the programmer to insert extra `&` / `*` noise in the *vast* majority of cases. This is a pedantic lint. changelog: Remove inefficient_to_string from default set of enabled lints
2 parents 1e1bd51 + e26ae7a commit 5ea4771

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

clippy_lints/src/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1111,6 +1111,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
11111111
LintId::of(&methods::FILTER_MAP),
11121112
LintId::of(&methods::FILTER_MAP_NEXT),
11131113
LintId::of(&methods::FIND_MAP),
1114+
LintId::of(&methods::INEFFICIENT_TO_STRING),
11141115
LintId::of(&methods::MAP_FLATTEN),
11151116
LintId::of(&methods::OPTION_MAP_UNWRAP_OR),
11161117
LintId::of(&methods::OPTION_MAP_UNWRAP_OR_ELSE),
@@ -1267,7 +1268,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
12671268
LintId::of(&methods::EXPECT_FUN_CALL),
12681269
LintId::of(&methods::FILTER_NEXT),
12691270
LintId::of(&methods::FLAT_MAP_IDENTITY),
1270-
LintId::of(&methods::INEFFICIENT_TO_STRING),
12711271
LintId::of(&methods::INTO_ITER_ON_REF),
12721272
LintId::of(&methods::ITERATOR_STEP_BY_ZERO),
12731273
LintId::of(&methods::ITER_CLONED_COLLECT),
@@ -1657,7 +1657,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
16571657
LintId::of(&loops::MANUAL_MEMCPY),
16581658
LintId::of(&loops::NEEDLESS_COLLECT),
16591659
LintId::of(&methods::EXPECT_FUN_CALL),
1660-
LintId::of(&methods::INEFFICIENT_TO_STRING),
16611660
LintId::of(&methods::ITER_NTH),
16621661
LintId::of(&methods::OR_FUN_CALL),
16631662
LintId::of(&methods::SINGLE_CHAR_PATTERN),

clippy_lints/src/methods/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ declare_clippy_lint! {
699699
/// ["foo", "bar"].iter().map(|&s| s.to_string());
700700
/// ```
701701
pub INEFFICIENT_TO_STRING,
702-
perf,
702+
pedantic,
703703
"using `to_string` on `&&T` where `T: ToString`"
704704
}
705705

src/lintlist/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,7 @@ pub static ref ALL_LINTS: Vec<Lint> = vec![
789789
},
790790
Lint {
791791
name: "inefficient_to_string",
792-
group: "perf",
792+
group: "pedantic",
793793
desc: "using `to_string` on `&&T` where `T: ToString`",
794794
deprecation: None,
795795
module: "methods",

0 commit comments

Comments
 (0)