about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-07-14 09:13:58 +0000
committerbors <bors@rust-lang.org>2020-07-14 09:13:58 +0000
commit12df6384b9bf0164396385187da5f7e7a60897a7 (patch)
treefbe8bc20765d1e6a6fa21a795c48b362bc7c59ce /src
parent4b8700879c59d1673dc36ea16aff3020af23dcc5 (diff)
parentb4091032abbadf586ea8c77bc547ec2ac403ef0a (diff)
downloadrust-12df6384b9bf0164396385187da5f7e7a60897a7.tar.gz
rust-12df6384b9bf0164396385187da5f7e7a60897a7.zip
Auto merge of #5773 - giraffate:repeat_once, r=flip1995
Add a lint for `.repeat(1)`

changelog: New lint `repeat_once`

fix #3028.
Diffstat (limited to 'src')
-rw-r--r--src/lintlist/mod.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/lintlist/mod.rs b/src/lintlist/mod.rs
index 0c77e07c872..b89a8712862 100644
--- a/src/lintlist/mod.rs
+++ b/src/lintlist/mod.rs
@@ -1887,6 +1887,13 @@ pub static ref ALL_LINTS: Vec<Lint> = vec![
         module: "reference",
     },
     Lint {
+        name: "repeat_once",
+        group: "complexity",
+        desc: "using `.repeat(1)` instead of `String.clone()`, `str.to_string()` or `slice.to_vec()` ",
+        deprecation: None,
+        module: "repeat_once",
+    },
+    Lint {
         name: "rest_pat_in_fully_bound_structs",
         group: "restriction",
         desc: "a match on a struct that binds all fields but still uses the wildcard pattern",