Skip to content

Commit

Permalink
tidy: fix most clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiaskrgr committed Jan 21, 2020
1 parent ce361fb commit 14c002e
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/tools/tidy/src/debug_artifacts.rs
Expand Up @@ -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");
Expand Down
4 changes: 2 additions & 2 deletions src/tools/tidy/src/error_codes_check.rs
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions src/tools/tidy/src/features.rs
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 }))
Expand Down
2 changes: 1 addition & 1 deletion src/tools/tidy/src/features/version.rs
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/tools/tidy/src/style.rs
Expand Up @@ -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::*;
Expand Down

0 comments on commit 14c002e

Please sign in to comment.