From ecd81f0f0788587d75d8d855339c323c8b0bf4af Mon Sep 17 00:00:00 2001 From: Daniel Eades Date: Sun, 19 Nov 2023 15:13:55 +0000 Subject: [PATCH] refactor --- renderer/src/lib.rs | 1 + style/src/theme.rs | 6 ------ widget/src/checkbox.rs | 1 + widget/src/dnd_source.rs | 2 +- widget/src/scrollable.rs | 1 + widget/src/slider.rs | 1 + widget/src/svg.rs | 1 + widget/src/text_input/text_input_wayland.rs | 2 +- widget/src/toggler.rs | 1 + winit/src/application.rs | 4 +++- 10 files changed, 11 insertions(+), 9 deletions(-) diff --git a/renderer/src/lib.rs b/renderer/src/lib.rs index c1bcdf14b2..a6672200f1 100644 --- a/renderer/src/lib.rs +++ b/renderer/src/lib.rs @@ -258,6 +258,7 @@ impl crate::graphics::geometry::Renderer for Renderer { crate::Geometry::TinySkia(primitive) => { renderer.draw_primitive(primitive); } + #[allow(unreachable_patterns)] _ => unreachable!(), } } diff --git a/style/src/theme.rs b/style/src/theme.rs index f711eadf17..f83d7391a4 100644 --- a/style/src/theme.rs +++ b/style/src/theme.rs @@ -22,12 +22,6 @@ use crate::svg; use crate::text_input; use crate::toggler; -use ::palette::FromColor; -use ::palette::RgbHue; -use iced_core::gradient::ColorStop; -use iced_core::gradient::Linear; -use iced_core::Degrees; -use iced_core::Radians; use iced_core::{Background, Color, Vector}; use std::rc::Rc; diff --git a/widget/src/checkbox.rs b/widget/src/checkbox.rs index dc4d203f74..2158206cda 100644 --- a/widget/src/checkbox.rs +++ b/widget/src/checkbox.rs @@ -1,5 +1,6 @@ //! Show toggle controls using checkboxes. use iced_runtime::core::widget::Id; +#[cfg(feature = "a11y")] use std::borrow::Cow; use crate::core::alignment; diff --git a/widget/src/dnd_source.rs b/widget/src/dnd_source.rs index eba61de01a..f4e2cb69b9 100644 --- a/widget/src/dnd_source.rs +++ b/widget/src/dnd_source.rs @@ -259,7 +259,7 @@ where return event::Status::Captured; } - let mut state = tree.state.downcast_mut::(); + let state = tree.state.downcast_mut::(); if matches!( event, diff --git a/widget/src/scrollable.rs b/widget/src/scrollable.rs index 12ca7d7e9a..64d817660f 100644 --- a/widget/src/scrollable.rs +++ b/widget/src/scrollable.rs @@ -1,5 +1,6 @@ //! Navigate an endless amount of content with a scrollbar. use iced_runtime::core::widget::Id; +#[cfg(feature = "a11y")] use std::borrow::Cow; use crate::core::event::{self, Event}; diff --git a/widget/src/slider.rs b/widget/src/slider.rs index 8a1efcdb4c..614b861e0d 100644 --- a/widget/src/slider.rs +++ b/widget/src/slider.rs @@ -13,6 +13,7 @@ use crate::core::{ Size, Widget, }; +#[cfg(feature = "a11y")] use std::borrow::Cow; use std::ops::RangeInclusive; diff --git a/widget/src/svg.rs b/widget/src/svg.rs index c0d59c2140..aaeb4c226c 100644 --- a/widget/src/svg.rs +++ b/widget/src/svg.rs @@ -10,6 +10,7 @@ use crate::core::{ ContentFit, Element, Layout, Length, Rectangle, Size, Vector, Widget, }; +#[cfg(feature = "a11y")] use std::borrow::Cow; use std::path::PathBuf; diff --git a/widget/src/text_input/text_input_wayland.rs b/widget/src/text_input/text_input_wayland.rs index 1ab966c654..3d8f65c956 100644 --- a/widget/src/text_input/text_input_wayland.rs +++ b/widget/src/text_input/text_input_wayland.rs @@ -1331,7 +1331,7 @@ where .iter() .find(|m| mime_types.contains(&m.to_string())) { - Some(m) => m.clone(), + Some(m) => m, None => { state.dnd_offer = DndOfferState::None; return event::Status::Captured; diff --git a/widget/src/toggler.rs b/widget/src/toggler.rs index 20dbb88e58..1f410c4188 100644 --- a/widget/src/toggler.rs +++ b/widget/src/toggler.rs @@ -1,4 +1,5 @@ //! Show toggle controls using togglers. +#[cfg(feature = "a11y")] use std::borrow::Cow; use crate::core::alignment; diff --git a/winit/src/application.rs b/winit/src/application.rs index 2c13b0b0c8..e4864c0257 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -4,6 +4,7 @@ mod drag_resize; mod profiler; mod state; +#[cfg(feature = "a11y")] use iced_graphics::core::widget::operation::focusable::focus; use iced_graphics::core::widget::operation::OperationWrapper; use iced_graphics::core::widget::Operation; @@ -383,6 +384,7 @@ async fn run_instance( let mut events = Vec::new(); let mut messages = Vec::new(); let mut redraw_pending = false; + #[cfg(feature = "a11y")] let mut commands: Vec> = Vec::new(); #[cfg(feature = "a11y")] @@ -1018,7 +1020,7 @@ pub fn run_command( window::Action::GainFocus => { window.focus_window(); } - window::Action::ChangeLevel(level) => { + window::Action::ChangeLevel(_level) => { // window.set_window_level(conversion::window_level(level)); } window::Action::FetchId(tag) => {