Rollup merge of #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
This commit is contained in:
Philipp Krones
2020-04-08 15:50:19 +02:00
committed by GitHub
3 changed files with 3 additions and 4 deletions
+1 -2
View File
@@ -1111,6 +1111,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
LintId::of(&methods::FILTER_MAP),
LintId::of(&methods::FILTER_MAP_NEXT),
LintId::of(&methods::FIND_MAP),
LintId::of(&methods::INEFFICIENT_TO_STRING),
LintId::of(&methods::MAP_FLATTEN),
LintId::of(&methods::OPTION_MAP_UNWRAP_OR),
LintId::of(&methods::OPTION_MAP_UNWRAP_OR_ELSE),
@@ -1267,7 +1268,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
LintId::of(&methods::EXPECT_FUN_CALL),
LintId::of(&methods::FILTER_NEXT),
LintId::of(&methods::FLAT_MAP_IDENTITY),
LintId::of(&methods::INEFFICIENT_TO_STRING),
LintId::of(&methods::INTO_ITER_ON_REF),
LintId::of(&methods::ITERATOR_STEP_BY_ZERO),
LintId::of(&methods::ITER_CLONED_COLLECT),
@@ -1657,7 +1657,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
LintId::of(&loops::MANUAL_MEMCPY),
LintId::of(&loops::NEEDLESS_COLLECT),
LintId::of(&methods::EXPECT_FUN_CALL),
LintId::of(&methods::INEFFICIENT_TO_STRING),
LintId::of(&methods::ITER_NTH),
LintId::of(&methods::OR_FUN_CALL),
LintId::of(&methods::SINGLE_CHAR_PATTERN),
+1 -1
View File
@@ -699,7 +699,7 @@
/// ["foo", "bar"].iter().map(|&s| s.to_string());
/// ```
pub INEFFICIENT_TO_STRING,
perf,
pedantic,
"using `to_string` on `&&T` where `T: ToString`"
}
+1 -1
View File
@@ -789,7 +789,7 @@
},
Lint {
name: "inefficient_to_string",
group: "perf",
group: "pedantic",
desc: "using `to_string` on `&&T` where `T: ToString`",
deprecation: None,
module: "methods",