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 authored and M-Adoo committed Dec 14, 2024
1 parent 38181a8 commit 047bf27
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 14 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/builtin_widgets/global_anchor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ pub enum GlobalAnchorY {
/// }
/// }
/// }
/// App::run(w);
/// App::run(app);
/// ```
pub struct GlobalAnchor {
/// the horizontal global anchor
Expand Down
2 changes: 1 addition & 1 deletion core/src/builtin_widgets/tooltips.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class_names! {
/// use ribir::prelude::*;
///
/// let w = fn_widget! {
/// @FilledButton{
/// @Text {
/// text: "hover to show tooltips!",
/// tooltips: "this is tooltips",
/// }
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
6 changes: 3 additions & 3 deletions core/src/overlay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ impl Overlay {
/// let wnd = e.window();
/// overlay.show_map(move |w| {
/// let mut w = FatObj::new(w);
/// w.get_global_anchor_widget()
/// .left_align_to($button.track_id(), 0., wnd.clone());
/// w.into_widget()
/// @$w {
/// global_anchor_x: GlobalAnchorX::left_align_to($button.track_id(), 0.),
/// }.into_widget()
/// },
/// e.window()
/// );
Expand Down
2 changes: 1 addition & 1 deletion core/src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,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"))
})
})
.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 047bf27

Please sign in to comment.