about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2020-01-21 15:33:17 +0100
committerMatthias Krüger <matthias.krueger@famsik.de>2020-01-21 15:33:17 +0100
commit14c002edb6a2e336dca09dca96df2b7228db95a8 (patch)
tree46a780c498cd5e209fbc742d0c75907ca58af4f7 /src
parentce361fb24f0896bf7d983549117cbe1f70f32dcf (diff)
downloadrust-14c002edb6a2e336dca09dca96df2b7228db95a8.tar.gz
rust-14c002edb6a2e336dca09dca96df2b7228db95a8.zip
tidy: fix most clippy warnings
Diffstat (limited to 'src')
-rw-r--r--src/tools/tidy/src/debug_artifacts.rs2
-rw-r--r--src/tools/tidy/src/error_codes_check.rs4
-rw-r--r--src/tools/tidy/src/features.rs4
-rw-r--r--src/tools/tidy/src/features/version.rs2
-rw-r--r--src/tools/tidy/src/style.rs2
5 files changed, 7 insertions, 7 deletions
diff --git a/src/tools/tidy/src/debug_artifacts.rs b/src/tools/tidy/src/debug_artifacts.rs
index 4664e2ef9a5..408be83b926 100644
--- a/src/tools/tidy/src/debug_artifacts.rs
+++ b/src/tools/tidy/src/debug_artifacts.rs
@@ -2,7 +2,7 @@
 
 use std::path::{Path, PathBuf};
 
-const GRAPHVIZ_POSTFLOW_MSG: &'static str = "`borrowck_graphviz_postflow` attribute in test";
+const GRAPHVIZ_POSTFLOW_MSG: &str = "`borrowck_graphviz_postflow` attribute in test";
 
 pub fn check(path: &Path, bad: &mut bool) {
     let test_dir: PathBuf = path.join("test");
diff --git a/src/tools/tidy/src/error_codes_check.rs b/src/tools/tidy/src/error_codes_check.rs
index ebaa81d2a8d..428c57d3ee8 100644
--- a/src/tools/tidy/src/error_codes_check.rs
+++ b/src/tools/tidy/src/error_codes_check.rs
@@ -53,7 +53,7 @@ fn extract_error_codes(f: &str, error_codes: &mut HashMap<String, bool>, path: &
                     error_codes.insert(err_code.clone(), false);
                 }
                 // Now we extract the tests from the markdown file!
-                let md = some_or_continue!(s.splitn(2, "include_str!(\"").skip(1).next());
+                let md = some_or_continue!(s.splitn(2, "include_str!(\"").nth(1));
                 let md_file_name = some_or_continue!(md.splitn(2, "\")").next());
                 let path = some_or_continue!(path.parent()).join(md_file_name);
                 match read_to_string(&path) {
@@ -84,7 +84,7 @@ fn extract_error_codes_from_tests(f: &str, error_codes: &mut HashMap<String, boo
         let s = line.trim();
         if s.starts_with("error[E") || s.starts_with("warning[E") {
             if let Some(err_code) = s.splitn(2, ']').next() {
-                if let Some(err_code) = err_code.splitn(2, '[').skip(1).next() {
+                if let Some(err_code) = err_code.splitn(2, '[').nth(1) {
                     let nb = error_codes.entry(err_code.to_owned()).or_insert(false);
                     *nb = true;
                 }
diff --git a/src/tools/tidy/src/features.rs b/src/tools/tidy/src/features.rs
index 325b45e0a70..12f93a87cb1 100644
--- a/src/tools/tidy/src/features.rs
+++ b/src/tools/tidy/src/features.rs
@@ -232,7 +232,7 @@ fn test_filen_gate(filen_underscore: &str, features: &mut Features) -> bool {
             }
         }
     }
-    return false;
+    false
 }
 
 pub fn collect_lang_features(base_src_path: &Path, bad: &mut bool) -> Features {
@@ -344,7 +344,7 @@ fn collect_lang_features_in(base: &Path, file: &str, bad: &mut bool) -> Features
                 }
                 None
             } else {
-                let s = issue_str.split('(').nth(1).unwrap().split(')').nth(0).unwrap();
+                let s = issue_str.split('(').nth(1).unwrap().split(')').next().unwrap();
                 Some(s.parse().unwrap())
             };
             Some((name.to_owned(), Feature { level, since, has_gate_test: false, tracking_issue }))
diff --git a/src/tools/tidy/src/features/version.rs b/src/tools/tidy/src/features/version.rs
index c8c39ad27e0..620be2f9852 100644
--- a/src/tools/tidy/src/features/version.rs
+++ b/src/tools/tidy/src/features/version.rs
@@ -38,7 +38,7 @@ impl FromStr for Version {
 
         let parts = [part()?, part()?, part()?];
 
-        if let Some(_) = iter.next() {
+        if iter.next().is_some() {
             // Ensure we don't have more than 3 parts.
             return Err(ParseVersionError::WrongNumberOfParts);
         }
diff --git a/src/tools/tidy/src/style.rs b/src/tools/tidy/src/style.rs
index b15c29921d2..4247fcb3b7f 100644
--- a/src/tools/tidy/src/style.rs
+++ b/src/tools/tidy/src/style.rs
@@ -58,7 +58,7 @@ enum LIUState {
 fn line_is_url(columns: usize, line: &str) -> bool {
     // more basic check for error_codes.rs, to avoid complexity in implementing two state machines
     if columns == ERROR_CODE_COLS {
-        return line.starts_with("[") && line.contains("]:") && line.contains("http");
+        return line.starts_with('[') && line.contains("]:") && line.contains("http");
     }
 
     use self::LIUState::*;