From 933ce2da10023c2023a253b9dc1ec31ff8b347d6 Mon Sep 17 00:00:00 2001 From: John Lapeyre Date: Sat, 13 Jan 2024 22:23:56 -0500 Subject: [PATCH] Use filter_map instead of map().filter_map() Closes #19 --- crates/oq3_source_file/src/source_file.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/crates/oq3_source_file/src/source_file.rs b/crates/oq3_source_file/src/source_file.rs index 393cc08..d627fdd 100644 --- a/crates/oq3_source_file/src/source_file.rs +++ b/crates/oq3_source_file/src/source_file.rs @@ -198,14 +198,12 @@ pub(crate) fn read_source_file(file_path: &Path) -> String { } // FIXME: prevent a file from including itself. Then there are two-file cycles, etc. -// FIXME: I want to disable filter_map_identity globally, but there is no option for clippy.toml -#[allow(clippy::filter_map_identity)] /// Recursively parse any files `include`d in the program `syntax_ast`. pub(crate) fn parse_included_files(syntax_ast: &ParsedSource) -> Vec { syntax_ast .tree() .statements() - .map(|parse_item| match parse_item { + .filter_map(|parse_item| match parse_item { synast::Stmt::Item(synast::Item::Include(include)) => { let file: synast::FilePath = include.file().unwrap(); let file_path = file.to_string().unwrap(); @@ -213,7 +211,6 @@ pub(crate) fn parse_included_files(syntax_ast: &ParsedSource) -> Vec } _ => None, }) - .filter_map(|x| x) .collect::>() }