Skip to content

Commit

Permalink
fix(core): 🐛 fix clippy warning
Browse files Browse the repository at this point in the history
  • Loading branch information
wjian23 committed Dec 13, 2024
1 parent ddf92de commit 70d51aa
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
1 change: 1 addition & 0 deletions core/src/animation/keyframes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ impl<S: AnimateStateSetter> KeyFrames<S> {
Self { state, frames: keyframes.into_boxed_slice() }
}

#[allow(clippy::type_complexity)]
/// Converts the `KeyFrames` into a `LerpFnState` that can be used for
/// animations.
pub fn into_lerp_fn_state(
Expand Down
2 changes: 1 addition & 1 deletion core/src/events/focus_mgr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ impl FocusManager {
.find(|request| {
request
.as_ref()
.map_or(true, |id| !id.is_dropped(arena))
.is_none_or(|id| !id.is_dropped(arena))
});

let focusing = next_focus
Expand Down
2 changes: 1 addition & 1 deletion core/src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ impl Window {
let tree = self.tree_mut();
let drop_conditional = wid
.query_ref::<KeepAlive>(tree)
.map_or(true, |d| !d.keep_alive);
.is_none_or(|d| !d.keep_alive);
let parent_dropped = parent
.as_ref()
.is_some_and(|p| p.ancestors(tree).any(|w| w.is_dropped(tree)));
Expand Down
5 changes: 2 additions & 3 deletions macros/src/child_template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,11 @@ fn option_type_extract(ty: &syn::Type) -> Option<&syn::Type> {
.filter(|s| s.ident == "Option")
.filter(|_| {
// the second last can be None or "option"
iter.next().map_or(true, |s| {
iter.next().is_none_or(|s| {
match_ident(s, "option")
&& iter
.next()
// the second last can be None or "option" or "core"
.map_or(true, |s| match_ident(s, "std") || match_ident(s, "core"))
.is_none_or(|s| match_ident(s, "std") || match_ident(s, "core"))

Check warning on line 241 in macros/src/child_template.rs

View check run for this annotation

Codecov / codecov/patch

macros/src/child_template.rs#L241

Added line #L241 was not covered by tests
})
})
.and_then(|s| match &s.arguments {
Expand Down
4 changes: 2 additions & 2 deletions macros/src/simple_declare_attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ impl<'a> DeclareField<'a> {
self
.attr
.as_ref()
.map_or(true, |attr| attr.skip.is_none())
.is_none_or(|attr| attr.skip.is_none())
}

pub fn is_strict(&self) -> bool {
Expand Down Expand Up @@ -189,7 +189,7 @@ impl<'a> DeclareField<'a> {
self
.attr
.as_ref()
.map_or(true, |attr| attr.custom.is_none() && attr.skip.is_none())
.is_none_or(|attr| attr.custom.is_none() && attr.skip.is_none())
}

pub fn doc_attr(&self) -> Option<&Attribute> {
Expand Down
2 changes: 1 addition & 1 deletion painter/src/text/shaper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ fn collect_miss_part<'a>(
last_miss_cluster = Some(glyph.cluster);
} else if last_miss_cluster
.as_ref()
.map_or(true, |cluster| *cluster != glyph.cluster)
.is_none_or(|cluster| *cluster != glyph.cluster)
&& miss_start.is_some()
{
miss_parts.push((miss_start.take().unwrap(), idx, helper.clone()));
Expand Down
2 changes: 1 addition & 1 deletion painter/src/text/typography_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ impl VisualGlyphs {
let order_info = &self.order_info.paras[para];
let locator = RangeLocator::from_unorder_ranges(order_info.runs.iter());
let dst_run = locator.range_index(cluster);
let is_ltr = dst_run.map_or(true, |run| order_info.levels[order_info.runs[run].start].is_ltr());
let is_ltr = dst_run.is_none_or(|run| order_info.levels[order_info.runs[run].start].is_ltr());
let is_layout_before = |glyph_cluster: usize| {
if dst_run.is_none() {
return true;
Expand Down

0 comments on commit 70d51aa

Please sign in to comment.