diff --git a/tasks/ast_codegen/src/generators/visit.rs b/tasks/ast_codegen/src/generators/visit.rs index f05da5cc0a575b..b0aa57176e0f4d 100644 --- a/tasks/ast_codegen/src/generators/visit.rs +++ b/tasks/ast_codegen/src/generators/visit.rs @@ -538,11 +538,11 @@ impl<'a> VisitBuilder<'a> { } let typ_wrapper = ty_res.wrapper; let markers = markers.unwrap(); - let visit_as = markers.as_ref().map(|mk| mk.visit_as.clone()).flatten(); - let visit_args = markers.map(|mk| mk.visit_args).flatten(); + let visit_as = markers.as_ref().and_then(|mk| mk.visit_as.clone()); + let visit_args = markers.and_then(|mk| mk.visit_args); let have_enter_scope = get_scope_markers(&it.attrs) - .is_some_and(|it| matches!(it, Ok(ScopeMarkers { enter_before: true, .. }))); + .is_some_and(|it| matches!(it, Ok(ScopeMarkers { enter_before: true }))); let have_enter_node = get_visit_markers(&it.attrs) .is_some_and(|it| matches!(it, Ok(VisitMarkers { enter_before: true, .. }))); diff --git a/tasks/ast_codegen/src/markers.rs b/tasks/ast_codegen/src/markers.rs index aa4f262854ee21..42872a107fca43 100644 --- a/tasks/ast_codegen/src/markers.rs +++ b/tasks/ast_codegen/src/markers.rs @@ -101,6 +101,7 @@ pub fn get_visit_markers<'a, I>(attrs: I) -> Option> where I: IntoIterator, { + #[allow(clippy::trivially_copy_pass_by_ref)] fn predicate(it: &&Attribute) -> bool { it.path().is_ident("visit") } @@ -145,7 +146,7 @@ where } } }) - .map(|_| VisitMarkers { visit_as, visit_args, enter_before, ignore }) + .map(|()| VisitMarkers { visit_as, visit_args, enter_before, ignore }) .normalize() }) } @@ -154,6 +155,7 @@ pub fn get_scope_markers<'a, I>(attrs: I) -> Option> where I: IntoIterator, { + #[allow(clippy::trivially_copy_pass_by_ref)] fn predicate(it: &&Attribute) -> bool { it.path().is_ident("scope") }