Skip to content

Commit

Permalink
fix: clippy warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
rzvxa committed Jul 20, 2024
1 parent 2d4d1e0 commit d77f7ee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions tasks/ast_codegen/src/generators/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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, .. })));

Expand Down
4 changes: 3 additions & 1 deletion tasks/ast_codegen/src/markers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ pub fn get_visit_markers<'a, I>(attrs: I) -> Option<crate::Result<VisitMarkers>>
where
I: IntoIterator<Item = &'a Attribute>,
{
#[allow(clippy::trivially_copy_pass_by_ref)]
fn predicate(it: &&Attribute) -> bool {
it.path().is_ident("visit")
}
Expand Down Expand Up @@ -145,7 +146,7 @@ where
}
}
})
.map(|_| VisitMarkers { visit_as, visit_args, enter_before, ignore })
.map(|()| VisitMarkers { visit_as, visit_args, enter_before, ignore })
.normalize()
})
}
Expand All @@ -154,6 +155,7 @@ pub fn get_scope_markers<'a, I>(attrs: I) -> Option<crate::Result<ScopeMarkers>>
where
I: IntoIterator<Item = &'a Attribute>,
{
#[allow(clippy::trivially_copy_pass_by_ref)]
fn predicate(it: &&Attribute) -> bool {
it.path().is_ident("scope")
}
Expand Down

0 comments on commit d77f7ee

Please sign in to comment.