tidy: fix most clippy warnings
This commit is contained in:
parent
ce361fb24f
commit
14c002edb6
@ -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");
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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 }))
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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::*;
|
||||
|
Loading…
x
Reference in New Issue
Block a user