Fix Clippy warnings
Browse files at this commit8fdea033bc4ab9f2318153bac0738157b391aad3Parent: 2e906fc1 changed file +4 -5
niri-config/tests/wiki-parses.rsmodified+4 -5
| @@ -14,7 +14,7 @@ fn extract_kdl_from_file(file_contents: &str, filename: &str) -> Vec<KdlCodeBloc | |||
| 14 | .map(|line| { | 14 | .map(|line| { |
| 15 | // Removes the > from callouts that might contain ```kdl``` | 15 | // Removes the > from callouts that might contain ```kdl``` |
| 16 | let line = line.trim(); | 16 | let line = line.trim(); |
| 17 | - if line.starts_with(">") { | 17 | + if line.starts_with('>') { |
| 18 | if line.len() == 1 { | 18 | if line.len() == 1 { |
| 19 | "" | 19 | "" |
| 20 | } else { | 20 | } else { |
| @@ -58,7 +58,7 @@ fn extract_kdl_from_file(file_contents: &str, filename: &str) -> Vec<KdlCodeBloc | |||
| 58 | fn wiki_docs_parses() { | 58 | fn wiki_docs_parses() { |
| 59 | let wiki_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../wiki"); | 59 | let wiki_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../wiki"); |
| 60 | 60 | ||
| 61 | - let code_blocks = fs::read_dir(&wiki_dir) | 61 | + let code_blocks = fs::read_dir(wiki_dir) |
| 62 | .unwrap() | 62 | .unwrap() |
| 63 | .filter_map(|entry| entry.ok()) | 63 | .filter_map(|entry| entry.ok()) |
| 64 | .filter(|entry| entry.file_type().is_ok_and(|ft| ft.is_file())) | 64 | .filter(|entry| entry.file_type().is_ok_and(|ft| ft.is_file())) |
| @@ -68,13 +68,12 @@ fn wiki_docs_parses() { | |||
| 68 | .map(|ext| ext == "md") | 68 | .map(|ext| ext == "md") |
| 69 | .unwrap_or(false) | 69 | .unwrap_or(false) |
| 70 | }) | 70 | }) |
| 71 | - .map(|file| { | 71 | + .flat_map(|file| { |
| 72 | let file_contents = fs::read_to_string(file.path()).unwrap(); | 72 | let file_contents = fs::read_to_string(file.path()).unwrap(); |
| 73 | let file_path = file.path(); | 73 | let file_path = file.path(); |
| 74 | let filename = file_path.to_str().unwrap(); | 74 | let filename = file_path.to_str().unwrap(); |
| 75 | extract_kdl_from_file(&file_contents, filename) | 75 | extract_kdl_from_file(&file_contents, filename) |
| 76 | - }) | 76 | + }); |
| 77 | - .flatten(); | ||
| 78 | 77 | ||
| 79 | let mut errors = vec![]; | 78 | let mut errors = vec![]; |
| 80 | 79 | ||