From 5e420f5dd23f7eb2e559233bfda04e3fd28a8349 Mon Sep 17 00:00:00 2001 From: Ashley Wulber Date: Fri, 18 Oct 2024 16:05:04 -0400 Subject: [PATCH] clippy --- src/keyframes.rs | 22 ---------------------- src/keyframes/cards.rs | 1 - src/keyframes/toggler.rs | 1 - src/timeline.rs | 7 +------ src/widget.rs | 8 -------- src/widget/cards.rs | 8 +------- 6 files changed, 2 insertions(+), 45 deletions(-) diff --git a/src/keyframes.rs b/src/keyframes.rs index 9758f4a..c2f5d33 100644 --- a/src/keyframes.rs +++ b/src/keyframes.rs @@ -2,17 +2,12 @@ mod cards; mod helpers; mod toggler; -use crate::reexports::iced_core::{widget, Length}; - pub use cards::Cards; pub use helpers::cards; pub use helpers::id; pub use helpers::lazy; pub use helpers::{chain, toggler}; pub use toggler::Toggler; - -use crate::Timeline; - /// The macro used to cleanly and efficently build an animation chain. /// Works for ann Id's that implement `into_chain` and `into_chain_with_children` #[macro_export] @@ -39,20 +34,3 @@ pub enum Repeat { Never, Forever, } - -pub trait IsChain { - fn repeat(&self) -> Repeat; -} - -pub fn get_length(id: &widget::Id, timeline: &Timeline, index: usize, default: Length) -> Length { - timeline - .get(id, index) - .map_or(default, |m| Length::Fixed(m.value)) -} - -fn as_f32(length: Option) -> Option { - match length { - Some(Length::Fixed(i)) => Some(i), - _ => None, - } -} diff --git a/src/keyframes/cards.rs b/src/keyframes/cards.rs index 7cc82b7..4058ce6 100644 --- a/src/keyframes/cards.rs +++ b/src/keyframes/cards.rs @@ -174,7 +174,6 @@ impl From for crate::timeline::Chain { #[must_use = "Keyframes are intended to be used in an animation chain."] #[derive(Debug, Clone, Copy)] -/// pub struct Cards { at: MovementType, ease: Ease, diff --git a/src/keyframes/toggler.rs b/src/keyframes/toggler.rs index ce25d4f..76d2698 100644 --- a/src/keyframes/toggler.rs +++ b/src/keyframes/toggler.rs @@ -155,7 +155,6 @@ impl From for crate::timeline::Chain { #[must_use = "Keyframes are intended to be used in an animation chain."] #[derive(Debug, Clone, Copy)] -/// pub struct Toggler { at: MovementType, ease: Ease, diff --git a/src/timeline.rs b/src/timeline.rs index 6610c43..bcd9e64 100644 --- a/src/timeline.rs +++ b/src/timeline.rs @@ -1,9 +1,6 @@ mod imports { pub use cosmic::iced::time::{Duration, Instant}; - pub use cosmic::iced_core::{ - event::{self, Event}, - widget, Hasher, - }; + pub use cosmic::iced_core::widget; pub use cosmic::iced_futures::subscription::Subscription; } @@ -574,8 +571,6 @@ impl Timeline { /// Efficiently request redraws for animations. /// Automatically checks if animations are in a state where redraws arn't necessary. pub fn as_subscription(&self) -> Subscription<(cosmic::iced::window::Id, Instant)> { - use cosmic::iced; - if self.is_idle() { Subscription::none() } else { diff --git a/src/widget.rs b/src/widget.rs index 6798161..f890e24 100644 --- a/src/widget.rs +++ b/src/widget.rs @@ -1,7 +1,4 @@ #![allow(clippy::too_many_arguments)] - -use crate::{reexports::iced_core, utils::static_array_from_iter}; - pub mod cards; pub mod cosmic_toggler; @@ -17,8 +14,3 @@ pub enum StyleType { /// The stlye is being animated. Blend between the two values. Blend(T, T, f32), } - -use self::iced_core::{ - gradient::{ColorStop, Linear}, - Background, Color, Gradient, Radians, Vector, -}; diff --git a/src/widget/cards.rs b/src/widget/cards.rs index 1c75ef7..405f9f7 100644 --- a/src/widget/cards.rs +++ b/src/widget/cards.rs @@ -5,13 +5,7 @@ use self::iced_core::{ }; use cosmic::{ iced_core::{self, Border, Shadow}, - widget::{ - button, - card::style::{Catalog, Style}, - column, icon, - icon::Handle, - row, text, - }, + widget::{button, card::style::Style, column, icon, icon::Handle, row, text}, }; use float_cmp::approx_eq;