Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tidy: fix most clippy warnings #68415

Merged
merged 1 commit into from
Jan 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/tools/tidy/src/debug_artifacts.rs
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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