diff options
| author | Philipp Krones <hello@philkrones.com> | 2020-04-08 15:50:19 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-08 15:50:19 +0200 |
| commit | 5ea477143318468460acde5495f69fe8855c456e (patch) | |
| tree | 92d1eba7e1e6abc5debb38bc61790ffd41f715fe | |
| parent | 1e1bd519a176f5e518c51814958dc64e8e7c1758 (diff) | |
| parent | e26ae7a0ff54cbb229790011df1031df68d258bb (diff) | |
| download | rust-5ea477143318468460acde5495f69fe8855c456e.tar.gz rust-5ea477143318468460acde5495f69fe8855c456e.zip | |
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
| -rw-r--r-- | clippy_lints/src/lib.rs | 3 | ||||
| -rw-r--r-- | clippy_lints/src/methods/mod.rs | 2 | ||||
| -rw-r--r-- | src/lintlist/mod.rs | 2 |
3 files changed, 3 insertions, 4 deletions
diff --git a/clippy_lints/src/lib.rs b/clippy_lints/src/lib.rs index fc7a3d8e021..e59cc8912d8 100644 --- a/clippy_lints/src/lib.rs +++ b/clippy_lints/src/lib.rs @@ -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), diff --git a/clippy_lints/src/methods/mod.rs b/clippy_lints/src/methods/mod.rs index 31dbf6b2b38..e287d2ad484 100644 --- a/clippy_lints/src/methods/mod.rs +++ b/clippy_lints/src/methods/mod.rs @@ -699,7 +699,7 @@ declare_clippy_lint! { /// ["foo", "bar"].iter().map(|&s| s.to_string()); /// ``` pub INEFFICIENT_TO_STRING, - perf, + pedantic, "using `to_string` on `&&T` where `T: ToString`" } diff --git a/src/lintlist/mod.rs b/src/lintlist/mod.rs index d7dab78fbe4..c48afc82347 100644 --- a/src/lintlist/mod.rs +++ b/src/lintlist/mod.rs @@ -789,7 +789,7 @@ pub static ref ALL_LINTS: Vec<Lint> = vec