Skip to content

Commit b6d6391

Browse files
authored
Rollup merge of #68415 - matthiaskrgr:tidy_clippy, r=oli-obk
tidy: fix most clippy warnings
2 parents 5850482 + 14c002e commit b6d6391

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

src/tools/tidy/src/debug_artifacts.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
use std::path::{Path, PathBuf};
44

5-
const GRAPHVIZ_POSTFLOW_MSG: &'static str = "`borrowck_graphviz_postflow` attribute in test";
5+
const GRAPHVIZ_POSTFLOW_MSG: &str = "`borrowck_graphviz_postflow` attribute in test";
66

77
pub fn check(path: &Path, bad: &mut bool) {
88
let test_dir: PathBuf = path.join("test");

src/tools/tidy/src/error_codes_check.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ fn extract_error_codes(f: &str, error_codes: &mut HashMap<String, bool>, path: &
5353
error_codes.insert(err_code.clone(), false);
5454
}
5555
// Now we extract the tests from the markdown file!
56-
let md = some_or_continue!(s.splitn(2, "include_str!(\"").skip(1).next());
56+
let md = some_or_continue!(s.splitn(2, "include_str!(\"").nth(1));
5757
let md_file_name = some_or_continue!(md.splitn(2, "\")").next());
5858
let path = some_or_continue!(path.parent()).join(md_file_name);
5959
match read_to_string(&path) {
@@ -84,7 +84,7 @@ fn extract_error_codes_from_tests(f: &str, error_codes: &mut HashMap<String, boo
8484
let s = line.trim();
8585
if s.starts_with("error[E") || s.starts_with("warning[E") {
8686
if let Some(err_code) = s.splitn(2, ']').next() {
87-
if let Some(err_code) = err_code.splitn(2, '[').skip(1).next() {
87+
if let Some(err_code) = err_code.splitn(2, '[').nth(1) {
8888
let nb = error_codes.entry(err_code.to_owned()).or_insert(false);
8989
*nb = true;
9090
}

src/tools/tidy/src/features.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ fn test_filen_gate(filen_underscore: &str, features: &mut Features) -> bool {
232232
}
233233
}
234234
}
235-
return false;
235+
false
236236
}
237237

238238
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
344344
}
345345
None
346346
} else {
347-
let s = issue_str.split('(').nth(1).unwrap().split(')').nth(0).unwrap();
347+
let s = issue_str.split('(').nth(1).unwrap().split(')').next().unwrap();
348348
Some(s.parse().unwrap())
349349
};
350350
Some((name.to_owned(), Feature { level, since, has_gate_test: false, tracking_issue }))

src/tools/tidy/src/features/version.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ impl FromStr for Version {
3838

3939
let parts = [part()?, part()?, part()?];
4040

41-
if let Some(_) = iter.next() {
41+
if iter.next().is_some() {
4242
// Ensure we don't have more than 3 parts.
4343
return Err(ParseVersionError::WrongNumberOfParts);
4444
}

src/tools/tidy/src/style.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ enum LIUState {
5858
fn line_is_url(columns: usize, line: &str) -> bool {
5959
// more basic check for error_codes.rs, to avoid complexity in implementing two state machines
6060
if columns == ERROR_CODE_COLS {
61-
return line.starts_with("[") && line.contains("]:") && line.contains("http");
61+
return line.starts_with('[') && line.contains("]:") && line.contains("http");
6262
}
6363

6464
use self::LIUState::*;

0 commit comments

Comments
 (0)