diff --git a/.zed/settings.json b/.zed/settings.json new file mode 100644 index 0000000..2cc7b98 --- /dev/null +++ b/.zed/settings.json @@ -0,0 +1,15 @@ +{ + "format_on_save": "on", + "lsp": { + "rust-analyzer": { + "initialization_options": { + "check": { + "command": "clippy", + }, + "rustfmt": { + "extraArgs": ["+nightly"], + }, + }, + }, + }, +} diff --git a/cosmic-config/src/dbus.rs b/cosmic-config/src/dbus.rs index da7bcb6..9b6e869 100644 --- a/cosmic-config/src/dbus.rs +++ b/cosmic-config/src/dbus.rs @@ -1,13 +1,12 @@ -use std::{any::TypeId, ops::Deref}; +use std::any::TypeId; +use std::ops::Deref; use crate::{CosmicConfigEntry, Update}; use cosmic_settings_daemon::{Changed, ConfigProxy, CosmicSettingsDaemonProxy}; use futures_util::SinkExt; -use iced_futures::{ - Subscription, - futures::{self, StreamExt, future::pending}, - stream, -}; +use iced_futures::futures::future::pending; +use iced_futures::futures::{self, StreamExt}; +use iced_futures::{Subscription, stream}; pub async fn settings_daemon_proxy() -> zbus::Result> { let conn = zbus::Connection::session().await?; diff --git a/cosmic-config/src/lib.rs b/cosmic-config/src/lib.rs index c8eda06..7ca9b90 100644 --- a/cosmic-config/src/lib.rs +++ b/cosmic-config/src/lib.rs @@ -1,16 +1,13 @@ //! Integrations for cosmic-config — the cosmic configuration system. -use notify::{ - RecommendedWatcher, Watcher, - event::{EventKind, ModifyKind, RenameMode}, -}; -use serde::{Serialize, de::DeserializeOwned}; -use std::{ - env, fmt, fs, - io::Write, - path::{Path, PathBuf}, - sync::Mutex, -}; +use notify::event::{EventKind, ModifyKind, RenameMode}; +use notify::{RecommendedWatcher, Watcher}; +use serde::Serialize; +use serde::de::DeserializeOwned; +use std::io::Write; +use std::path::{Path, PathBuf}; +use std::sync::Mutex; +use std::{env, fmt, fs}; /// Get the config directory, with Flatpak sandbox support. /// In Flatpak, HOST_XDG_CONFIG_HOME points to the real user config directory, diff --git a/cosmic-config/src/subscription.rs b/cosmic-config/src/subscription.rs index d16b9b6..f038787 100644 --- a/cosmic-config/src/subscription.rs +++ b/cosmic-config/src/subscription.rs @@ -1,7 +1,9 @@ +use iced_futures::futures::channel::mpsc; use iced_futures::futures::{SinkExt, Stream}; -use iced_futures::{futures::channel::mpsc, stream}; +use iced_futures::stream; use notify::RecommendedWatcher; -use std::{borrow::Cow, hash::Hash}; +use std::borrow::Cow; +use std::hash::Hash; use crate::{Config, CosmicConfigEntry}; @@ -77,7 +79,8 @@ async fn start_listening, output: &mut mpsc::Sender>, ) -> ConfigState { - use iced_futures::futures::{StreamExt, future::pending}; + use iced_futures::futures::StreamExt; + use iced_futures::futures::future::pending; match state { ConfigState::Init(config_id, version, is_state) => { diff --git a/cosmic-theme/src/model/theme.rs b/cosmic-theme/src/model/theme.rs index 1bc8050..a403403 100644 --- a/cosmic-theme/src/model/theme.rs +++ b/cosmic-theme/src/model/theme.rs @@ -1,13 +1,13 @@ +use crate::composite::over; +use crate::steps::{color_index, get_small_widget_color, get_surface_color, get_text, steps}; use crate::{ Component, Container, CornerRadii, CosmicPalette, CosmicPaletteInner, DARK_PALETTE, LIGHT_PALETTE, NAME, Spacing, ThemeMode, - composite::over, - steps::{color_index, get_small_widget_color, get_surface_color, get_text, steps}, }; use cosmic_config::{Config, CosmicConfigEntry}; -use palette::{ - IntoColor, Oklcha, Srgb, Srgba, WithAlpha, color_difference::Wcag21RelativeContrast, rgb::Rgb, -}; +use palette::color_difference::Wcag21RelativeContrast; +use palette::rgb::Rgb; +use palette::{IntoColor, Oklcha, Srgb, Srgba, WithAlpha}; use serde::{Deserialize, Serialize}; use std::num::NonZeroUsize; diff --git a/cosmic-theme/src/output/gtk4_output.rs b/cosmic-theme/src/output/gtk4_output.rs index 40eba5b..16a3c36 100644 --- a/cosmic-theme/src/output/gtk4_output.rs +++ b/cosmic-theme/src/output/gtk4_output.rs @@ -1,11 +1,12 @@ -use crate::{Component, Theme, composite::over, steps::steps}; -use palette::{Darken, IntoColor, Lighten, Srgba, WithAlpha, rgb::Rgba}; -use std::{ - fs::{self, File}, - io::{self, Write}, - num::NonZeroUsize, - path::Path, -}; +use crate::composite::over; +use crate::steps::steps; +use crate::{Component, Theme}; +use palette::rgb::Rgba; +use palette::{Darken, IntoColor, Lighten, Srgba, WithAlpha}; +use std::fs::{self, File}; +use std::io::{self, Write}; +use std::num::NonZeroUsize; +use std::path::Path; use super::{OutputError, to_rgba}; diff --git a/cosmic-theme/src/output/mod.rs b/cosmic-theme/src/output/mod.rs index 19f7bc5..04dce39 100644 --- a/cosmic-theme/src/output/mod.rs +++ b/cosmic-theme/src/output/mod.rs @@ -1,5 +1,6 @@ use configparser::ini::WriteOptions; -use palette::{Srgba, rgb::Rgba}; +use palette::Srgba; +use palette::rgb::Rgba; use thiserror::Error; use crate::Theme; diff --git a/cosmic-theme/src/output/qt56ct_output.rs b/cosmic-theme/src/output/qt56ct_output.rs index 43a4547..16df211 100644 --- a/cosmic-theme/src/output/qt56ct_output.rs +++ b/cosmic-theme/src/output/qt56ct_output.rs @@ -1,12 +1,12 @@ use crate::Theme; use configparser::ini::Ini; -use palette::{Mix, Srgba, WithAlpha, blend::Compose, rgb::Rgba}; -use std::{ - fs::{self, File}, - io::Write, - path::PathBuf, - vec, -}; +use palette::blend::Compose; +use palette::rgb::Rgba; +use palette::{Mix, Srgba, WithAlpha}; +use std::fs::{self, File}; +use std::io::Write; +use std::path::PathBuf; +use std::vec; use super::{OutputError, qt_settings_ini_style}; diff --git a/cosmic-theme/src/output/qt_output.rs b/cosmic-theme/src/output/qt_output.rs index d42d553..84614e7 100644 --- a/cosmic-theme/src/output/qt_output.rs +++ b/cosmic-theme/src/output/qt_output.rs @@ -1,12 +1,11 @@ use crate::Theme; use configparser::ini::Ini; use cosmic_config::CosmicConfigEntry; -use palette::{Mix, Srgba, blend::Compose}; -use std::{ - fs::{self, File}, - io::{self, Write}, - path::{Path, PathBuf}, -}; +use palette::blend::Compose; +use palette::{Mix, Srgba}; +use std::fs::{self, File}; +use std::io::{self, Write}; +use std::path::{Path, PathBuf}; use super::{OutputError, qt_settings_ini_style}; diff --git a/cosmic-theme/src/steps.rs b/cosmic-theme/src/steps.rs index 6ebf101..d156722 100644 --- a/cosmic-theme/src/steps.rs +++ b/cosmic-theme/src/steps.rs @@ -1,7 +1,8 @@ use std::num::NonZeroUsize; use almost::equal; -use palette::{ClampAssign, FromColor, Lch, Oklcha, Srgb, Srgba, convert::FromColorUnclamped}; +use palette::convert::FromColorUnclamped; +use palette::{ClampAssign, FromColor, Lch, Oklcha, Srgb, Srgba}; /// Get an array of 100 colors with a specific hue and chroma /// over the full range of lightness. diff --git a/examples/about/src/main.rs b/examples/about/src/main.rs index c25a9b9..d1ea475 100644 --- a/examples/about/src/main.rs +++ b/examples/about/src/main.rs @@ -8,7 +8,8 @@ use cosmic::app::{Core, Settings, Task}; use cosmic::executor; use cosmic::iced::{alignment, Length, Size}; use cosmic::prelude::*; -use cosmic::widget::{self, about::About, nav_bar}; +use cosmic::widget::about::About; +use cosmic::widget::{self, nav_bar}; /// Runs application with these settings #[rustfmt::skip] diff --git a/examples/applet/src/window.rs b/examples/applet/src/window.rs index 22903ea..57546ab 100644 --- a/examples/applet/src/window.rs +++ b/examples/applet/src/window.rs @@ -4,7 +4,8 @@ use cosmic::iced::core::window; use cosmic::iced::window::Id; use cosmic::iced::{Length, Rectangle}; use cosmic::surface::action::{app_popup, destroy_popup}; -use cosmic::widget::{dropdown::popup_dropdown, list_column, settings, toggler}; +use cosmic::widget::dropdown::popup_dropdown; +use cosmic::widget::{list_column, settings, toggler}; use cosmic::Element; const ID: &str = "com.system76.CosmicAppletExample"; diff --git a/examples/application/src/main.rs b/examples/application/src/main.rs index f6e571e..9f89061 100644 --- a/examples/application/src/main.rs +++ b/examples/application/src/main.rs @@ -5,9 +5,10 @@ use cosmic::app::Settings; use cosmic::iced::{Alignment, Length, Size}; +use cosmic::prelude::*; use cosmic::widget::menu::{self, KeyBind}; use cosmic::widget::nav_bar; -use cosmic::{executor, iced, prelude::*, widget, Core}; +use cosmic::{executor, iced, widget, Core}; use std::collections::HashMap; use std::sync::LazyLock; diff --git a/examples/cosmic/src/window.rs b/examples/cosmic/src/window.rs index 9fce876..4168718 100644 --- a/examples/cosmic/src/window.rs +++ b/examples/cosmic/src/window.rs @@ -23,15 +23,11 @@ use cosmic::{ Element, }; use cosmic_time::{Instant, Timeline}; -use std::{ - cell::RefCell, - rc::Rc, - sync::{ - atomic::{AtomicU32, Ordering}, - Arc, - }, - vec, -}; +use std::cell::RefCell; +use std::rc::Rc; +use std::sync::atomic::{AtomicU32, Ordering}; +use std::sync::Arc; +use std::vec; // XXX The use of button is removed because it assigns the same ID to multiple buttons, causing a crash when a11y is enabled... // static BTN: Lazy = Lazy::new(|| id::Id::new("BTN")); diff --git a/examples/cosmic/src/window/bluetooth.rs b/examples/cosmic/src/window/bluetooth.rs index 1b5892f..2878b46 100644 --- a/examples/cosmic/src/window/bluetooth.rs +++ b/examples/cosmic/src/window/bluetooth.rs @@ -1,9 +1,7 @@ use super::{Page, Window}; -use cosmic::{ - iced::widget::{column, text}, - widget::{list_column, settings, toggler}, - Element, -}; +use cosmic::iced::widget::{column, text}; +use cosmic::widget::{list_column, settings, toggler}; +use cosmic::Element; #[derive(Clone, Copy, Debug)] pub enum Message { diff --git a/examples/cosmic/src/window/demo.rs b/examples/cosmic/src/window/demo.rs index 0d31fa9..20a730b 100644 --- a/examples/cosmic/src/window/demo.rs +++ b/examples/cosmic/src/window/demo.rs @@ -1,19 +1,17 @@ -use std::{cell::RefCell, rc::Rc}; +use std::cell::RefCell; +use std::rc::Rc; use apply::Apply; -use cosmic::{ - cosmic_theme, - iced::widget::{checkbox, column, progress_bar, radio, slider, text}, - iced::{Alignment, Length}, - iced_core::id, - theme::ThemeType, - widget::{ - button, color_picker::ColorPickerUpdate, dropdown, icon, layer_container as container, - segmented_button, segmented_control, settings, spin_button, tab_bar, toggler, - ColorPickerModel, - }, - Element, +use cosmic::iced::widget::{checkbox, column, progress_bar, radio, slider, text}; +use cosmic::iced::{Alignment, Length}; +use cosmic::iced_core::id; +use cosmic::theme::ThemeType; +use cosmic::widget::color_picker::ColorPickerUpdate; +use cosmic::widget::{ + button, dropdown, icon, layer_container as container, segmented_button, segmented_control, + settings, spin_button, tab_bar, toggler, ColorPickerModel, }; +use cosmic::{cosmic_theme, Element}; use cosmic_time::{anim, chain, Timeline}; use fraction::{Decimal, ToPrimitive}; use once_cell::sync::Lazy; diff --git a/examples/cosmic/src/window/desktop.rs b/examples/cosmic/src/window/desktop.rs index 46a4e5b..a087de9 100644 --- a/examples/cosmic/src/window/desktop.rs +++ b/examples/cosmic/src/window/desktop.rs @@ -1,10 +1,7 @@ -use cosmic::{ - iced::widget::{column, container, horizontal_space, image, row, svg, text}, - iced::Length, - theme, - widget::{list_column, settings, toggler}, - Element, -}; +use cosmic::iced::widget::{column, container, horizontal_space, image, row, svg, text}; +use cosmic::iced::Length; +use cosmic::widget::{list_column, settings, toggler}; +use cosmic::{theme, Element}; use super::{Page, SubPage, Window}; diff --git a/examples/cosmic/src/window/system_and_accounts.rs b/examples/cosmic/src/window/system_and_accounts.rs index ed1bd00..5f49885 100644 --- a/examples/cosmic/src/window/system_and_accounts.rs +++ b/examples/cosmic/src/window/system_and_accounts.rs @@ -1,9 +1,7 @@ -use cosmic::{ - iced::widget::{horizontal_space, row, text}, - iced::Length, - widget::{icon, list_column, settings}, - Element, -}; +use cosmic::iced::widget::{horizontal_space, row, text}; +use cosmic::iced::Length; +use cosmic::widget::{icon, list_column, settings}; +use cosmic::Element; use super::{Message, Page, SubPage, Window}; diff --git a/examples/menu/src/main.rs b/examples/menu/src/main.rs index da0c323..900d032 100644 --- a/examples/menu/src/main.rs +++ b/examples/menu/src/main.rs @@ -9,11 +9,9 @@ use std::{env, process}; use cosmic::app::{Core, Settings, Task}; use cosmic::iced::alignment::{Horizontal, Vertical}; use cosmic::iced::keyboard::Key; -use cosmic::iced::window; -use cosmic::iced::{Length, Size}; +use cosmic::iced::{window, Length, Size}; use cosmic::widget::menu::action::MenuAction; -use cosmic::widget::menu::key_bind::KeyBind; -use cosmic::widget::menu::key_bind::Modifier; +use cosmic::widget::menu::key_bind::{KeyBind, Modifier}; use cosmic::widget::menu::{self, ItemHeight, ItemWidth}; use cosmic::widget::RcElementWrapper; use cosmic::{executor, Element}; diff --git a/examples/multi-window/src/window.rs b/examples/multi-window/src/window.rs index 754a0d8..a6d40d3 100644 --- a/examples/multi-window/src/window.rs +++ b/examples/multi-window/src/window.rs @@ -1,13 +1,11 @@ use std::collections::HashMap; -use cosmic::{ - app::Core, - iced::core::{id, Alignment, Length, Point}, - iced::widget::{column, container, scrollable, text}, - iced::{self, event, window, Subscription}, - prelude::*, - widget::{button, header_bar}, -}; +use cosmic::app::Core; +use cosmic::iced::core::{id, Alignment, Length, Point}; +use cosmic::iced::widget::{column, container, scrollable, text}; +use cosmic::iced::{self, event, window, Subscription}; +use cosmic::prelude::*; +use cosmic::widget::{button, header_bar}; #[derive(Debug, Clone, PartialEq)] pub enum Message { diff --git a/examples/spin-button/src/main.rs b/examples/spin-button/src/main.rs index 47db4dc..0228291 100644 --- a/examples/spin-button/src/main.rs +++ b/examples/spin-button/src/main.rs @@ -1,15 +1,8 @@ -use cosmic::iced::Length; +use cosmic::app::{Core, Task}; +use cosmic::iced::alignment::{Horizontal, Vertical}; +use cosmic::iced::{self, Alignment, Length, Size}; use cosmic::widget::{column, container, spin_button}; -use cosmic::Apply; -use cosmic::{ - app::{Core, Task}, - iced::{ - self, - alignment::{Horizontal, Vertical}, - Alignment, Size, - }, - Application, Element, -}; +use cosmic::{Application, Apply, Element}; use fraction::Decimal; pub struct SpinButtonExamplApp { diff --git a/examples/subscriptions/src/main.rs b/examples/subscriptions/src/main.rs index 17e630a..325af16 100644 --- a/examples/subscriptions/src/main.rs +++ b/examples/subscriptions/src/main.rs @@ -5,7 +5,8 @@ use cosmic::app::{Core, Settings, Task}; use cosmic::iced::Subscription; -use cosmic::{executor, prelude::*, widget}; +use cosmic::prelude::*; +use cosmic::{executor, widget}; /// Runs application with these settings fn main() -> Result<(), Box> { diff --git a/examples/table-view/src/main.rs b/examples/table-view/src/main.rs index d247842..e518b3c 100644 --- a/examples/table-view/src/main.rs +++ b/examples/table-view/src/main.rs @@ -9,8 +9,7 @@ use chrono::Datelike; use cosmic::app::{Core, Settings, Task}; use cosmic::iced::Size; use cosmic::prelude::*; -use cosmic::widget::table; -use cosmic::widget::{self, nav_bar}; +use cosmic::widget::{self, nav_bar, table}; use cosmic::{executor, iced}; #[derive(Debug, Default, PartialEq, Eq, Clone, Copy, Hash)] diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 0000000..c1578aa --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1 @@ +imports_granularity = "Module" diff --git a/src/app/action.rs b/src/app/action.rs index fb982ac..166df16 100644 --- a/src/app/action.rs +++ b/src/app/action.rs @@ -1,10 +1,10 @@ // Copyright 2023 System76 // SPDX-License-Identifier: MPL-2.0 -use crate::surface; +use crate::config::CosmicTk; use crate::theme::Theme; use crate::widget::nav_bar; -use crate::{config::CosmicTk, keyboard_nav}; +use crate::{keyboard_nav, surface}; #[cfg(all(feature = "wayland", target_os = "linux"))] use cctk::sctk::reexports::csd_frame::{WindowManagerCapabilities, WindowState}; use cosmic_theme::ThemeMode; diff --git a/src/app/mod.rs b/src/app/mod.rs index ad1ceef..264f1d1 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -22,11 +22,11 @@ use crate::prelude::*; use crate::theme::THEME; use crate::widget::{container, id_container, menu, nav_bar, popover, space}; use apply::Apply; -use iced::{Length, Subscription}; -use iced::{theme, window}; +use iced::{Length, Subscription, theme, window}; pub use settings::Settings; use std::borrow::Cow; -use std::{cell::RefCell, rc::Rc}; +use std::cell::RefCell; +use std::rc::Rc; #[cold] pub(crate) fn iced_settings( diff --git a/src/applet/column.rs b/src/applet/column.rs index 9657b56..1ec9c73 100644 --- a/src/applet/column.rs +++ b/src/applet/column.rs @@ -2,14 +2,10 @@ use crate::iced; use iced::core::alignment::{self, Alignment}; use iced::core::event::{self, Event}; -use iced::core::layout; -use iced::core::mouse; -use iced::core::overlay; -use iced::core::renderer; use iced::core::widget::{Operation, Tree}; use iced::core::{ Clipboard, Element, Layout, Length, Padding, Pixels, Rectangle, Shell, Size, Vector, Widget, - widget, + layout, mouse, overlay, renderer, widget, }; /// A container that distributes its contents vertically. diff --git a/src/applet/mod.rs b/src/applet/mod.rs index 48721e1..e16b030 100644 --- a/src/applet/mod.rs +++ b/src/applet/mod.rs @@ -1,37 +1,31 @@ #[cfg(feature = "applet-token")] pub mod token; -use crate::app::{BootData, BootDataInner, cosmic}; -use crate::{ - Application, Element, Renderer, - app::iced_settings, - cctk::sctk, - theme::{self, Button, THEME, system_dark, system_light}, - widget::{ - self, - autosize::{self, Autosize, autosize}, - column::Column, - layer_container, - row::Row, - space::horizontal, - space::vertical, - }, -}; +use crate::app::{BootData, BootDataInner, cosmic, iced_settings}; +use crate::cctk::sctk; +use crate::theme::{self, Button, THEME, system_dark, system_light}; +use crate::widget::autosize::{self, Autosize, autosize}; +use crate::widget::column::Column; +use crate::widget::row::Row; +use crate::widget::space::{horizontal, vertical}; +use crate::widget::{self, layer_container}; +use crate::{Application, Element, Renderer}; pub use cosmic_panel_config; use cosmic_panel_config::{CosmicPanelBackground, PanelAnchor, PanelSize}; -use iced::{ - self, Color, Length, Limits, Rectangle, - alignment::{Alignment, Horizontal, Vertical}, - widget::Container, - window, -}; +use iced::alignment::{Alignment, Horizontal, Vertical}; +use iced::widget::Container; +use iced::{self, Color, Length, Limits, Rectangle, window}; use iced_core::{Padding, Shadow}; use iced_runtime::platform_specific::wayland::popup::{SctkPopupSettings, SctkPositioner}; use iced_widget::Text; use sctk::reexports::protocols::xdg::shell::client::xdg_positioner::{Anchor, Gravity}; +use std::borrow::Cow; use std::cell::RefCell; -use std::{borrow::Cow, num::NonZeroU32, rc::Rc, sync::LazyLock, time::Duration}; +use std::num::NonZeroU32; +use std::rc::Rc; +use std::sync::LazyLock; +use std::time::Duration; use tracing::info; pub mod column; diff --git a/src/applet/row.rs b/src/applet/row.rs index a6745d1..718f366 100644 --- a/src/applet/row.rs +++ b/src/applet/row.rs @@ -3,12 +3,10 @@ use crate::iced; use iced::core::alignment::{self, Alignment}; use iced::core::event::{self, Event}; use iced::core::layout::{self, Layout}; -use iced::core::mouse; -use iced::core::overlay; -use iced::core::renderer; use iced::core::widget::{Operation, Tree}; use iced::core::{ - Clipboard, Element, Length, Padding, Pixels, Rectangle, Shell, Size, Vector, Widget, widget, + Clipboard, Element, Length, Padding, Pixels, Rectangle, Shell, Size, Vector, Widget, mouse, + overlay, renderer, widget, }; use iced::touch; diff --git a/src/applet/token/subscription.rs b/src/applet/token/subscription.rs index 07c528e..64be0ce 100644 --- a/src/applet/token/subscription.rs +++ b/src/applet/token/subscription.rs @@ -1,13 +1,12 @@ use crate::iced; use cctk::sctk::reexports::calloop; -use futures::{ - SinkExt, StreamExt, - channel::mpsc::{UnboundedReceiver, unbounded}, -}; +use futures::channel::mpsc::{UnboundedReceiver, unbounded}; +use futures::{SinkExt, StreamExt}; use iced::Subscription; -use iced_futures::futures; -use iced_futures::stream; -use std::{fmt::Debug, hash::Hash, thread::JoinHandle}; +use iced_futures::{futures, stream}; +use std::fmt::Debug; +use std::hash::Hash; +use std::thread::JoinHandle; use super::wayland_handler::wayland_handler; diff --git a/src/applet/token/wayland_handler.rs b/src/applet/token/wayland_handler.rs index 3db84fc..4ab7323 100644 --- a/src/applet/token/wayland_handler.rs +++ b/src/applet/token/wayland_handler.rs @@ -1,27 +1,20 @@ -use std::os::{ - fd::{FromRawFd, RawFd}, - unix::net::UnixStream, -}; +use std::os::fd::{FromRawFd, RawFd}; +use std::os::unix::net::UnixStream; use super::subscription::{TokenRequest, TokenUpdate}; -use cctk::{ - sctk::{ - self, - activation::{RequestData, RequestDataExt}, - reexports::{calloop, calloop_wayland_source::WaylandSource}, - seat::{SeatHandler, SeatState}, - }, - wayland_client::{ - self, - protocol::{wl_seat::WlSeat, wl_surface::WlSurface}, - }, -}; +use cctk::sctk::activation::{RequestData, RequestDataExt}; +use cctk::sctk::reexports::calloop; +use cctk::sctk::reexports::calloop_wayland_source::WaylandSource; +use cctk::sctk::seat::{SeatHandler, SeatState}; +use cctk::sctk::{self}; +use cctk::wayland_client::protocol::wl_seat::WlSeat; +use cctk::wayland_client::protocol::wl_surface::WlSurface; +use cctk::wayland_client::{self}; use iced_futures::futures::channel::mpsc::UnboundedSender; -use sctk::{ - activation::{ActivationHandler, ActivationState}, - registry::{ProvidesRegistryState, RegistryState}, -}; -use wayland_client::{Connection, QueueHandle, globals::registry_queue_init}; +use sctk::activation::{ActivationHandler, ActivationState}; +use sctk::registry::{ProvidesRegistryState, RegistryState}; +use wayland_client::globals::registry_queue_init; +use wayland_client::{Connection, QueueHandle}; struct AppData { exit: bool, diff --git a/src/dbus_activation.rs b/src/dbus_activation.rs index 99e2f9f..e7bc690 100644 --- a/src/dbus_activation.rs +++ b/src/dbus_activation.rs @@ -1,17 +1,15 @@ // Copyright 2024 System76 // SPDX-License-Identifier: MPL-2.0 -use { - crate::ApplicationExt, - iced::Subscription, - iced_futures::futures::{ - SinkExt, - channel::mpsc::{Receiver, Sender}, - }, - std::{any::TypeId, collections::HashMap}, - url::Url, - zbus::{interface, proxy, zvariant::Value}, -}; +use crate::ApplicationExt; +use iced::Subscription; +use iced_futures::futures::SinkExt; +use iced_futures::futures::channel::mpsc::{Receiver, Sender}; +use std::any::TypeId; +use std::collections::HashMap; +use url::Url; +use zbus::zvariant::Value; +use zbus::{interface, proxy}; #[cold] pub fn subscription() -> Subscription> { diff --git a/src/desktop.rs b/src/desktop.rs index 98ce7d4..cfa7a66 100644 --- a/src/desktop.rs +++ b/src/desktop.rs @@ -872,7 +872,8 @@ trait SystemdManger { #[cfg(all(test, not(windows)))] mod tests { use super::*; - use std::{env, fs, path::Path, path::PathBuf}; + use std::path::{Path, PathBuf}; + use std::{env, fs}; use tempfile::tempdir; struct EnvVarGuard { diff --git a/src/localize.rs b/src/localize.rs index 95a3165..d63d970 100644 --- a/src/localize.rs +++ b/src/localize.rs @@ -1,9 +1,7 @@ // SPDX-License-Identifier: GPL-3.0-only -use i18n_embed::{ - DefaultLocalizer, LanguageLoader, Localizer, - fluent::{FluentLanguageLoader, fluent_language_loader}, -}; +use i18n_embed::fluent::{FluentLanguageLoader, fluent_language_loader}; +use i18n_embed::{DefaultLocalizer, LanguageLoader, Localizer}; use rust_embed::RustEmbed; use std::sync::{LazyLock, OnceLock}; diff --git a/src/surface/action.rs b/src/surface/action.rs index 50e2b4a..5bd5a29 100644 --- a/src/surface/action.rs +++ b/src/surface/action.rs @@ -6,7 +6,8 @@ use super::Action; use crate::Application; use iced::window; -use std::{any::Any, sync::Arc}; +use std::any::Any; +use std::sync::Arc; /// Used to produce a destroy popup message from within a widget. #[cfg(all(feature = "wayland", target_os = "linux"))] diff --git a/src/surface/mod.rs b/src/surface/mod.rs index 0dad645..307b527 100644 --- a/src/surface/mod.rs +++ b/src/surface/mod.rs @@ -3,9 +3,7 @@ pub mod action; -use iced::Limits; -use iced::Size; -use iced::Task; +use iced::{Limits, Size, Task}; use std::future::Future; use std::sync::Arc; diff --git a/src/theme/mod.rs b/src/theme/mod.rs index 093bac0..a5ae5d4 100644 --- a/src/theme/mod.rs +++ b/src/theme/mod.rs @@ -7,12 +7,8 @@ pub mod portal; pub mod style; -use cosmic_config::CosmicConfigEntry; -use cosmic_config::config_subscription; -use cosmic_theme::Component; -use cosmic_theme::LayeredTheme; -use cosmic_theme::Spacing; -use cosmic_theme::ThemeMode; +use cosmic_config::{CosmicConfigEntry, config_subscription}; +use cosmic_theme::{Component, LayeredTheme, Spacing, ThemeMode}; use iced_futures::Subscription; use iced_runtime::{Appearance, DefaultStyle}; use std::sync::{Arc, LazyLock, Mutex}; diff --git a/src/theme/style/button.rs b/src/theme/style/button.rs index e83e48e..f84c9e9 100644 --- a/src/theme/style/button.rs +++ b/src/theme/style/button.rs @@ -6,10 +6,8 @@ use cosmic_theme::Component; use iced_core::{Background, Color}; -use crate::{ - theme::TRANSPARENT_COMPONENT, - widget::button::{Catalog, Style}, -}; +use crate::theme::TRANSPARENT_COMPONENT; +use crate::widget::button::{Catalog, Style}; #[derive(Default)] pub enum Button { diff --git a/src/theme/style/iced.rs b/src/theme/style/iced.rs index aa6f4b3..1761f6a 100644 --- a/src/theme/style/iced.rs +++ b/src/theme/style/iced.rs @@ -5,18 +5,17 @@ use crate::theme::{CosmicComponent, TRANSPARENT_COMPONENT, Theme}; use cosmic_theme::composite::over; -use iced::{ - overlay::menu, - theme::Base, - widget::{ - button as iced_button, checkbox as iced_checkbox, combo_box, container as iced_container, - pane_grid, pick_list, progress_bar, radio, rule, scrollable, - slider::{self, Rail}, - svg, toggler, - }, +use iced::overlay::menu; +use iced::theme::Base; +use iced::widget::slider::{self, Rail}; +use iced::widget::{ + button as iced_button, checkbox as iced_checkbox, combo_box, container as iced_container, + pane_grid, pick_list, progress_bar, radio, rule, scrollable, svg, toggler, }; use iced_core::{Background, Border, Color, Shadow, Vector}; -use iced_widget::{pane_grid::Highlight, scrollable::AutoScroll, text_editor, text_input}; +use iced_widget::pane_grid::Highlight; +use iced_widget::scrollable::AutoScroll; +use iced_widget::{text_editor, text_input}; use palette::WithAlpha; use std::rc::Rc; diff --git a/src/theme/style/segmented_button.rs b/src/theme/style/segmented_button.rs index b9863c8..381c4a0 100644 --- a/src/theme/style/segmented_button.rs +++ b/src/theme/style/segmented_button.rs @@ -3,10 +3,13 @@ //! Contains stylesheet implementation for [`crate::widget::segmented_button`]. -use crate::widget::segmented_button::{Appearance, ItemAppearance, StyleSheet}; -use crate::{theme::Theme, widget::segmented_button::ItemStatusAppearance}; +use crate::theme::Theme; +use crate::widget::segmented_button::{ + Appearance, ItemAppearance, ItemStatusAppearance, StyleSheet, +}; use iced::Border; -use iced_core::{Background, border::Radius}; +use iced_core::Background; +use iced_core::border::Radius; use palette::WithAlpha; #[derive(Default)] @@ -143,7 +146,8 @@ mod horizontal { use crate::widget::segmented_button::{ItemAppearance, ItemStatusAppearance}; use cosmic_theme::{Component, Container}; use iced::Border; - use iced_core::{Background, border::Radius}; + use iced_core::Background; + use iced_core::border::Radius; use palette::WithAlpha; pub fn tab_bar(cosmic: &cosmic_theme::Theme, container: &Container) -> Appearance { @@ -250,7 +254,8 @@ mod vertical { use crate::widget::segmented_button::{ItemAppearance, ItemStatusAppearance}; use cosmic_theme::{Component, Container}; use iced::Border; - use iced_core::{Background, border::Radius}; + use iced_core::Background; + use iced_core::border::Radius; use palette::WithAlpha; pub fn tab_bar(cosmic: &cosmic_theme::Theme, container: &Container) -> Appearance { diff --git a/src/widget/about.rs b/src/widget/about.rs index 9b21e93..490b037 100644 --- a/src/widget/about.rs +++ b/src/widget/about.rs @@ -1,8 +1,6 @@ -use crate::{ - Apply, Element, fl, - iced::{Alignment, Length}, - widget::{self, list}, -}; +use crate::iced::{Alignment, Length}; +use crate::widget::{self, list}; +use crate::{Apply, Element, fl}; use std::rc::Rc; #[derive(Debug, Default, Clone, derive_setters::Setters)] diff --git a/src/widget/aspect_ratio.rs b/src/widget/aspect_ratio.rs index 577bea9..5cd8b9c 100644 --- a/src/widget/aspect_ratio.rs +++ b/src/widget/aspect_ratio.rs @@ -3,13 +3,10 @@ use iced::Size; use iced::widget::Container; use iced_core::event::Event; -use iced_core::layout; -use iced_core::mouse; -use iced_core::overlay; -use iced_core::renderer; use iced_core::widget::Tree; use iced_core::{ Alignment, Clipboard, Element, Layout, Length, Padding, Rectangle, Shell, Vector, Widget, + layout, mouse, overlay, renderer, }; pub use iced_widget::container::{Catalog, Style}; diff --git a/src/widget/autosize.rs b/src/widget/autosize.rs index 69fd9c8..c52367d 100644 --- a/src/widget/autosize.rs +++ b/src/widget/autosize.rs @@ -1,12 +1,11 @@ //! Autosize Container, which will resize the window to its contents. use iced_core::event::{self, Event}; -use iced_core::layout; -use iced_core::mouse; -use iced_core::overlay; -use iced_core::renderer; use iced_core::widget::{Id, Operation, Tree}; -use iced_core::{Clipboard, Element, Layout, Length, Rectangle, Shell, Vector, Widget}; +use iced_core::{ + Clipboard, Element, Layout, Length, Rectangle, Shell, Vector, Widget, layout, mouse, overlay, + renderer, +}; pub use iced_widget::container::{Catalog, Style}; pub fn autosize<'a, Message: 'static, Theme, E>( diff --git a/src/widget/button/icon.rs b/src/widget/button/icon.rs index 04d2bdd..6be1300 100644 --- a/src/widget/button/icon.rs +++ b/src/widget/button/icon.rs @@ -3,9 +3,13 @@ use super::{Builder, ButtonClass}; use crate::Element; -use crate::widget::{icon::Handle, tooltip}; +use crate::widget::icon::Handle; +use crate::widget::tooltip; use apply::Apply; -use iced_core::{Alignment, Length, Padding, font::Weight, text::LineHeight, widget::Id}; +use iced_core::font::Weight; +use iced_core::text::LineHeight; +use iced_core::widget::Id; +use iced_core::{Alignment, Length, Padding}; use std::borrow::Cow; pub type Button<'a, Message> = Builder<'a, Message, Icon>; diff --git a/src/widget/button/image.rs b/src/widget/button/image.rs index ab51e66..3b38203 100644 --- a/src/widget/button/image.rs +++ b/src/widget/button/image.rs @@ -2,11 +2,12 @@ // SPDX-License-Identifier: MPL-2.0 use super::Builder; -use crate::{ - Element, - widget::{self, image::Handle}, -}; -use iced_core::{Length, Padding, font::Weight, widget::Id}; +use crate::Element; +use crate::widget::image::Handle; +use crate::widget::{self}; +use iced_core::font::Weight; +use iced_core::widget::Id; +use iced_core::{Length, Padding}; use std::borrow::Cow; pub type Button<'a, Message> = Builder<'a, Message, Image<'a, Handle, Message>>; diff --git a/src/widget/button/link.rs b/src/widget/button/link.rs index 9ce8126..c0afd32 100644 --- a/src/widget/button/link.rs +++ b/src/widget/button/link.rs @@ -3,14 +3,15 @@ //! Hyperlink button widget -use super::Builder; -use super::ButtonClass; +use super::{Builder, ButtonClass}; use crate::Element; use crate::prelude::*; use crate::widget::icon::{self, Handle}; use crate::widget::{button, row, tooltip}; +use iced_core::font::Weight; use iced_core::text::LineHeight; -use iced_core::{Alignment, Length, Padding, font::Weight, widget::Id}; +use iced_core::widget::Id; +use iced_core::{Alignment, Length, Padding}; use std::borrow::Cow; pub type Button<'a, Message> = Builder<'a, Message, Hyperlink>; diff --git a/src/widget/button/style.rs b/src/widget/button/style.rs index 21afa08..f8df8c6 100644 --- a/src/widget/button/style.rs +++ b/src/widget/button/style.rs @@ -2,7 +2,8 @@ // SPDX-License-Identifier: MPL-2.0 //! Change the apperance of a button. -use iced_core::{Background, Color, Vector, border::Radius}; +use iced_core::border::Radius; +use iced_core::{Background, Color, Vector}; use crate::theme::THEME; diff --git a/src/widget/button/text.rs b/src/widget/button/text.rs index bcdd02b..52ab614 100644 --- a/src/widget/button/text.rs +++ b/src/widget/button/text.rs @@ -4,7 +4,10 @@ use super::{Builder, ButtonClass}; use crate::widget::{icon, row, tooltip}; use crate::{Apply, Element}; -use iced_core::{Alignment, Length, Padding, font::Weight, text::LineHeight, widget::Id}; +use iced_core::font::Weight; +use iced_core::text::LineHeight; +use iced_core::widget::Id; +use iced_core::{Alignment, Length, Padding}; use std::borrow::Cow; pub type Button<'a, Message> = Builder<'a, Message, Text>; diff --git a/src/widget/button/widget.rs b/src/widget/button/widget.rs index 4acf3f2..cca54fd 100644 --- a/src/widget/button/widget.rs +++ b/src/widget/button/widget.rs @@ -11,15 +11,12 @@ use iced_runtime::{Action, Task, keyboard, task}; use iced_core::event::{self, Event}; use iced_core::renderer::{self, Quad, Renderer}; -use iced_core::touch; use iced_core::widget::Operation; use iced_core::widget::tree::{self, Tree}; use iced_core::{ - Background, Clipboard, Color, Layout, Length, Padding, Point, Rectangle, Shell, Vector, Widget, + Background, Border, Clipboard, Color, Layout, Length, Padding, Point, Rectangle, Shadow, Shell, + Vector, Widget, layout, mouse, overlay, svg, touch, }; -use iced_core::{Border, mouse}; -use iced_core::{Shadow, overlay}; -use iced_core::{layout, svg}; use iced_renderer::core::widget::operation; use crate::theme::THEME; @@ -647,10 +644,8 @@ impl<'a, Message: 'a + Clone> Widget state: &Tree, p: mouse::Cursor, ) -> iced_accessibility::A11yTree { - use iced_accessibility::{ - A11yNode, A11yTree, - accesskit::{Action, Node, NodeId, Rect, Role}, - }; + use iced_accessibility::accesskit::{Action, Node, NodeId, Rect, Role}; + use iced_accessibility::{A11yNode, A11yTree}; // TODO why is state None sometimes? if matches!(state.state, iced_core::widget::tree::State::None) { tracing::info!("Button state is missing."); diff --git a/src/widget/calendar.rs b/src/widget/calendar.rs index 91c601d..35632c3 100644 --- a/src/widget/calendar.rs +++ b/src/widget/calendar.rs @@ -8,10 +8,8 @@ use crate::widget::{button, column, grid, icon, row, text}; use apply::Apply; use iced::alignment::Vertical; use iced_core::{Alignment, Length}; -use jiff::{ - ToSpan, - civil::{Date, Weekday}, -}; +use jiff::ToSpan; +use jiff::civil::{Date, Weekday}; /// A widget that displays an interactive calendar. pub fn calendar( diff --git a/src/widget/cards.rs b/src/widget/cards.rs index 66267a7..0001474 100644 --- a/src/widget/cards.rs +++ b/src/widget/cards.rs @@ -1,23 +1,18 @@ //! An expandable stack of cards use std::time::Duration; -use crate::{ - anim, - widget::{ - button, - card::style::Style, - column, - icon::{self, Handle}, - row, text, - }, -}; +use crate::anim; +use crate::widget::card::style::Style; +use crate::widget::icon::{self, Handle}; +use crate::widget::{button, column, row, text}; use float_cmp::approx_eq; use iced::widget; -use iced_core::{ - Border, Element, Event, Length, Shadow, Size, Vector, Widget, border::Radius, id::Id, - layout::Node, renderer::Quad, widget::Tree, -}; -use iced_core::{widget::tree, window}; +use iced_core::border::Radius; +use iced_core::id::Id; +use iced_core::layout::Node; +use iced_core::renderer::Quad; +use iced_core::widget::{Tree, tree}; +use iced_core::{Border, Element, Event, Length, Shadow, Size, Vector, Widget, window}; const ICON_SIZE: u16 = 16; const TOP_SPACING: u16 = 4; diff --git a/src/widget/color_picker/mod.rs b/src/widget/color_picker/mod.rs index 318e943..66ffd84 100644 --- a/src/widget/color_picker/mod.rs +++ b/src/widget/color_picker/mod.rs @@ -12,7 +12,9 @@ use std::time::{Duration, Instant}; use crate::Element; use crate::theme::iced::Slider; use crate::theme::{Button, THEME}; -use crate::widget::{button::Catalog, container, segmented_button::Entity, slider}; +use crate::widget::button::Catalog; +use crate::widget::segmented_button::Entity; +use crate::widget::{container, slider}; use derive_setters::Setters; use iced::Task; use iced_core::event::{self, Event}; @@ -25,10 +27,8 @@ use iced_core::{ }; use iced_widget::slider::HandleShape; -use iced_widget::{ - Row, canvas, column, row, scrollable, - space::{horizontal, vertical}, -}; +use iced_widget::space::{horizontal, vertical}; +use iced_widget::{Row, canvas, column, row, scrollable}; use palette::{FromColor, RgbHue}; use super::divider::horizontal; diff --git a/src/widget/context_drawer/overlay.rs b/src/widget/context_drawer/overlay.rs index 39b3421..01f5cfc 100644 --- a/src/widget/context_drawer/overlay.rs +++ b/src/widget/context_drawer/overlay.rs @@ -5,8 +5,7 @@ use crate::Element; use iced::advanced::layout::{self, Layout}; use iced::advanced::widget::{self, Operation}; -use iced::advanced::{Clipboard, Shell}; -use iced::advanced::{overlay, renderer}; +use iced::advanced::{Clipboard, Shell, overlay, renderer}; use iced::{Event, Point, Size, mouse}; use iced_core::{Renderer, touch}; diff --git a/src/widget/context_drawer/widget.rs b/src/widget/context_drawer/widget.rs index 7420738..9a7448e 100644 --- a/src/widget/context_drawer/widget.rs +++ b/src/widget/context_drawer/widget.rs @@ -6,11 +6,10 @@ use crate::widget::{self, LayerContainer, button, column, container, icon, row, use crate::{Apply, Element, Renderer, Theme, fl}; use std::borrow::Cow; -use iced_core::Alignment; use iced_core::event::Event; use iced_core::widget::{Operation, Tree}; use iced_core::{ - Clipboard, Layout, Length, Rectangle, Shell, Vector, Widget, layout, mouse, + Alignment, Clipboard, Layout, Length, Rectangle, Shell, Vector, Widget, layout, mouse, overlay as iced_overlay, renderer, }; diff --git a/src/widget/context_menu.rs b/src/widget/context_menu.rs index 3f35f04..bd950bf 100644 --- a/src/widget/context_menu.rs +++ b/src/widget/context_menu.rs @@ -81,7 +81,8 @@ impl ContextMenu<'_, Message> { my_state: &mut LocalState, ) { if self.window_id != window::Id::NONE && self.on_surface_action.is_some() { - use crate::{surface::action::destroy_popup, widget::menu::Menu}; + use crate::surface::action::destroy_popup; + use crate::widget::menu::Menu; use iced_runtime::platform_specific::wayland::popup::{ SctkPopupSettings, SctkPositioner, }; diff --git a/src/widget/dialog.rs b/src/widget/dialog.rs index 7d08462..72ab11f 100644 --- a/src/widget/dialog.rs +++ b/src/widget/dialog.rs @@ -1,8 +1,5 @@ -use crate::{ - Element, - iced::{Length, Pixels}, - style, theme, widget, -}; +use crate::iced::{Length, Pixels}; +use crate::{Element, style, theme, widget}; use std::borrow::Cow; pub fn dialog<'a, Message>() -> Dialog<'a, Message> { diff --git a/src/widget/dnd_destination.rs b/src/widget/dnd_destination.rs index 10bf7a8..0ebff3d 100644 --- a/src/widget/dnd_destination.rs +++ b/src/widget/dnd_destination.rs @@ -1,29 +1,17 @@ -use std::{ - borrow::Cow, - sync::atomic::{AtomicU64, Ordering}, -}; +use std::borrow::Cow; +use std::sync::atomic::{AtomicU64, Ordering}; use iced::Vector; -use crate::{ - Element, - widget::{Id, Widget}, -}; +use crate::Element; +use crate::widget::{Id, Widget}; -use iced::{ - Event, Length, Rectangle, - clipboard::{ - dnd::{self, DndAction, DndDestinationRectangle, DndEvent, OfferEvent}, - mime::AllowedMimeTypes, - }, - event, - id::Internal, - mouse, overlay, -}; -use iced_core::{ - self, Clipboard, Shell, layout, - widget::{Tree, tree}, -}; +use iced::clipboard::dnd::{self, DndAction, DndDestinationRectangle, DndEvent, OfferEvent}; +use iced::clipboard::mime::AllowedMimeTypes; +use iced::id::Internal; +use iced::{Event, Length, Rectangle, event, mouse, overlay}; +use iced_core::widget::{Tree, tree}; +use iced_core::{self, Clipboard, Shell, layout}; pub fn dnd_destination<'a, Message: 'static>( child: impl Into>, diff --git a/src/widget/dnd_source.rs b/src/widget/dnd_source.rs index 980723e..3cc9fa7 100644 --- a/src/widget/dnd_source.rs +++ b/src/widget/dnd_source.rs @@ -1,20 +1,14 @@ use std::any::Any; -use iced_core::{widget::Operation, window}; +use iced_core::widget::Operation; +use iced_core::window; -use crate::{ - Element, - widget::{Id, Widget, container}, -}; -use iced::{ - Event, Length, Point, Rectangle, Vector, - clipboard::dnd::{DndAction, DndEvent, SourceEvent}, - event, mouse, overlay, -}; -use iced_core::{ - self, Clipboard, Shell, layout, renderer, - widget::{Tree, tree}, -}; +use crate::Element; +use crate::widget::{Id, Widget, container}; +use iced::clipboard::dnd::{DndAction, DndEvent, SourceEvent}; +use iced::{Event, Length, Point, Rectangle, Vector, event, mouse, overlay}; +use iced_core::widget::{Tree, tree}; +use iced_core::{self, Clipboard, Shell, layout, renderer}; pub fn dnd_source< 'a, diff --git a/src/widget/dropdown/menu/appearance.rs b/src/widget/dropdown/menu/appearance.rs index d1bed21..2c32c01 100644 --- a/src/widget/dropdown/menu/appearance.rs +++ b/src/widget/dropdown/menu/appearance.rs @@ -3,7 +3,8 @@ // SPDX-License-Identifier: MPL-2.0 AND MIT //! Change the appearance of menus. -use iced_core::{Background, Color, border::Radius}; +use iced_core::border::Radius; +use iced_core::{Background, Color}; /// The appearance of a menu. #[derive(Debug, Clone, Copy)] diff --git a/src/widget/dropdown/multi/widget.rs b/src/widget/dropdown/multi/widget.rs index 779c6d0..3c01f5f 100644 --- a/src/widget/dropdown/multi/widget.rs +++ b/src/widget/dropdown/multi/widget.rs @@ -9,9 +9,9 @@ use iced_core::event::{self, Event}; use iced_core::text::{self, Paragraph, Text}; use iced_core::widget::tree::{self, Tree}; use iced_core::{ - Clipboard, Layout, Length, Padding, Pixels, Rectangle, Shell, Size, Vector, Widget, + Clipboard, Layout, Length, Padding, Pixels, Rectangle, Shadow, Shell, Size, Vector, Widget, + alignment, keyboard, layout, mouse, overlay, renderer, svg, touch, }; -use iced_core::{Shadow, alignment, keyboard, layout, mouse, overlay, renderer, svg, touch}; use iced_widget::pick_list; use std::ffi::OsStr; diff --git a/src/widget/dropdown/widget.rs b/src/widget/dropdown/widget.rs index 2ff9c92..046cf84 100644 --- a/src/widget/dropdown/widget.rs +++ b/src/widget/dropdown/widget.rs @@ -12,9 +12,9 @@ use iced_core::event::{self, Event}; use iced_core::text::{self, Paragraph, Text}; use iced_core::widget::tree::{self, Tree}; use iced_core::{ - Clipboard, Layout, Length, Padding, Pixels, Rectangle, Shell, Size, Vector, Widget, + Clipboard, Layout, Length, Padding, Pixels, Rectangle, Shadow, Shell, Size, Vector, Widget, + alignment, keyboard, layout, mouse, overlay, renderer, svg, touch, }; -use iced_core::{Shadow, alignment, keyboard, layout, mouse, overlay, renderer, svg, touch}; use iced_widget::pick_list::{self, Catalog}; use std::borrow::Cow; use std::ffi::OsStr; diff --git a/src/widget/frames.rs b/src/widget/frames.rs index a542cec..bf985ce 100644 --- a/src/widget/frames.rs +++ b/src/widget/frames.rs @@ -2,14 +2,12 @@ //! Based on use std::ffi::OsStr; -use std::fmt; -use std::io; use std::path::Path; use std::time::{Duration, Instant}; +use std::{fmt, io}; use ::image as image_rs; -use iced::Task; -use iced::mouse; +use iced::{Task, mouse}; use iced_core::image::Renderer as ImageRenderer; use iced_core::mouse::Cursor; use iced_core::widget::{Tree, tree}; diff --git a/src/widget/header_bar.rs b/src/widget/header_bar.rs index 0a10b0a..556466f 100644 --- a/src/widget/header_bar.rs +++ b/src/widget/header_bar.rs @@ -5,7 +5,8 @@ use crate::cosmic_theme::{Density, Spacing}; use crate::{Element, theme, widget}; use apply::Apply; use derive_setters::Setters; -use iced_core::{Length, Size, Vector, Widget, layout, text, widget::tree}; +use iced_core::widget::tree; +use iced_core::{Length, Size, Vector, Widget, layout, text}; use std::borrow::Cow; #[must_use] diff --git a/src/widget/icon/named.rs b/src/widget/icon/named.rs index dfd66cf..c6bec75 100644 --- a/src/widget/icon/named.rs +++ b/src/widget/icon/named.rs @@ -2,7 +2,10 @@ // SPDX-License-Identifier: MPL-2.0 use super::{Handle, Icon}; -use std::{borrow::Cow, ffi::OsStr, path::PathBuf, sync::Arc}; +use std::borrow::Cow; +use std::ffi::OsStr; +use std::path::PathBuf; +use std::sync::Arc; #[derive(Debug, Clone, Default, Hash)] /// Fallback icon to use if the icon was not found. diff --git a/src/widget/id_container.rs b/src/widget/id_container.rs index 716ee13..6b0d13c 100644 --- a/src/widget/id_container.rs +++ b/src/widget/id_container.rs @@ -1,10 +1,9 @@ use iced_core::event::{self, Event}; -use iced_core::layout; -use iced_core::mouse; -use iced_core::overlay; -use iced_core::renderer; use iced_core::widget::{Id, Operation, Tree}; -use iced_core::{Clipboard, Element, Layout, Length, Rectangle, Shell, Vector, Widget}; +use iced_core::{ + Clipboard, Element, Layout, Length, Rectangle, Shell, Vector, Widget, layout, mouse, overlay, + renderer, +}; pub use iced_widget::container::{Catalog, Style}; pub fn id_container<'a, Message: 'static, Theme, E>( diff --git a/src/widget/layer_container.rs b/src/widget/layer_container.rs index 110af51..3958b03 100644 --- a/src/widget/layer_container.rs +++ b/src/widget/layer_container.rs @@ -2,13 +2,10 @@ use crate::Theme; use cosmic_theme::LayeredTheme; use iced::widget::Container; use iced_core::event::{self, Event}; -use iced_core::layout; -use iced_core::mouse; -use iced_core::overlay; -use iced_core::renderer; use iced_core::widget::Tree; use iced_core::{ Alignment, Clipboard, Element, Layout, Length, Padding, Rectangle, Shell, Vector, Widget, + layout, mouse, overlay, renderer, }; pub use iced_widget::container::{Catalog, Style}; diff --git a/src/widget/list/list_column.rs b/src/widget/list/list_column.rs index 4ef3fc0..9e4204c 100644 --- a/src/widget/list/list_column.rs +++ b/src/widget/list/list_column.rs @@ -2,7 +2,8 @@ // SPDX-License-Identifier: MPL-2.0 use crate::widget::container::Catalog; -use crate::widget::{button, column, container, divider, row, space::vertical}; +use crate::widget::space::vertical; +use crate::widget::{button, column, container, divider, row}; use crate::{Apply, Element, theme}; use iced::{Length, Padding}; diff --git a/src/widget/menu/flex.rs b/src/widget/menu/flex.rs index 4a58f13..213ee69 100644 --- a/src/widget/menu/flex.rs +++ b/src/widget/menu/flex.rs @@ -1,11 +1,9 @@ // From iced_aw, license MIT -use iced_core::{Widget, widget::Tree}; -use iced_widget::core::{ - Alignment, Element, Padding, Point, Size, - layout::{Limits, Node}, - renderer, -}; +use iced_core::Widget; +use iced_core::widget::Tree; +use iced_widget::core::layout::{Limits, Node}; +use iced_widget::core::{Alignment, Element, Padding, Point, Size, renderer}; use crate::widget::RcElementWrapper; diff --git a/src/widget/menu/menu_bar.rs b/src/widget/menu/menu_bar.rs index 981446e..b5ffca4 100644 --- a/src/widget/menu/menu_bar.rs +++ b/src/widget/menu/menu_bar.rs @@ -1,14 +1,14 @@ // From iced_aw, license MIT //! A widget that handles menu trees -use std::{collections::HashMap, sync::Arc}; +use std::collections::HashMap; +use std::sync::Arc; -use super::{ - menu_inner::{ - CloseCondition, Direction, ItemHeight, ItemWidth, Menu, MenuState, PathHighlight, - }, - menu_tree::MenuTree, +use super::menu_inner::{ + CloseCondition, Direction, ItemHeight, ItemWidth, Menu, MenuState, PathHighlight, }; +use super::menu_tree::MenuTree; +use crate::Renderer; #[cfg(all( feature = "multi-window", feature = "wayland", @@ -17,26 +17,21 @@ use super::{ feature = "surface-message" ))] use crate::app::cosmic::{WINDOWING_SYSTEM, WindowingSystem}; -use crate::{ - Renderer, - style::menu_bar::StyleSheet, - widget::{ - RcWrapper, - dropdown::menu::{self, State}, - menu::menu_inner::init_root_menu, - }, -}; +use crate::style::menu_bar::StyleSheet; +use crate::widget::RcWrapper; +use crate::widget::dropdown::menu::{self, State}; +use crate::widget::menu::menu_inner::init_root_menu; -use iced::{Point, Shadow, Vector, event::Status, window}; +use iced::event::Status; +use iced::{Point, Shadow, Vector, window}; use iced_core::Border; +use iced_widget::core::layout::{Limits, Node}; +use iced_widget::core::mouse::{self, Cursor}; +use iced_widget::core::renderer::{self, Renderer as IcedRenderer}; +use iced_widget::core::widget::{Tree, tree}; use iced_widget::core::{ Alignment, Clipboard, Element, Layout, Length, Padding, Rectangle, Shell, Widget, event, - layout::{Limits, Node}, - mouse::{self, Cursor}, - overlay, - renderer::{self, Renderer as IcedRenderer}, - touch, - widget::{Tree, tree}, + overlay, touch, }; /// A `MenuBar` collects `MenuTree`s and handles all the layout, event processing, and drawing. @@ -590,7 +585,8 @@ where viewport: &Rectangle, ) { use event::Event::{Mouse, Touch}; - use mouse::{Button::Left, Event::ButtonReleased}; + use mouse::Button::Left; + use mouse::Event::ButtonReleased; use touch::Event::{FingerLifted, FingerLost}; process_root_events( diff --git a/src/widget/menu/menu_inner.rs b/src/widget/menu/menu_inner.rs index 74afe60..6211e20 100644 --- a/src/widget/menu/menu_inner.rs +++ b/src/widget/menu/menu_inner.rs @@ -1,9 +1,11 @@ // From iced_aw, license MIT //! Menu tree overlay -use std::{borrow::Cow, sync::Arc}; +use std::borrow::Cow; +use std::sync::Arc; -use super::{menu_bar::MenuBarState, menu_tree::MenuTree}; +use super::menu_bar::MenuBarState; +use super::menu_tree::MenuTree; #[cfg(all( feature = "multi-window", feature = "wayland", @@ -16,12 +18,12 @@ use crate::style::menu_bar::StyleSheet; use iced::window; use iced_core::{Border, Renderer as IcedRenderer, Shadow, Widget}; +use iced_widget::core::layout::{Limits, Node}; +use iced_widget::core::mouse::{self, Cursor}; +use iced_widget::core::widget::Tree; use iced_widget::core::{ - Clipboard, Layout, Length, Padding, Point, Rectangle, Shell, Size, Vector, event, - layout::{Limits, Node}, - mouse::{self, Cursor}, - overlay, renderer, touch, - widget::Tree, + Clipboard, Layout, Length, Padding, Point, Rectangle, Shell, Size, Vector, event, overlay, + renderer, touch, }; /// The condition of when to close a menu @@ -559,14 +561,10 @@ impl<'b, Message: Clone + 'static> Menu<'b, Message> { clipboard: &mut dyn Clipboard, shell: &mut Shell<'_, Message>, ) -> Option<(usize, MenuState)> { - use event::{ - Event::{Mouse, Touch}, - Status::{Captured, Ignored}, - }; - use mouse::{ - Button::Left, - Event::{ButtonPressed, ButtonReleased, CursorMoved, WheelScrolled}, - }; + use event::Event::{Mouse, Touch}; + use event::Status::{Captured, Ignored}; + use mouse::Button::Left; + use mouse::Event::{ButtonPressed, ButtonReleased, CursorMoved, WheelScrolled}; use touch::Event::{FingerLifted, FingerMoved, FingerPressed}; if !self diff --git a/src/widget/mod.rs b/src/widget/mod.rs index f442b0d..d0dee7c 100644 --- a/src/widget/mod.rs +++ b/src/widget/mod.rs @@ -154,7 +154,7 @@ pub use dialog::{Dialog, dialog}; pub mod divider { /// Horizontal variant of a divider. pub mod horizontal { - use iced::{widget::Rule, widget::rule}; + use iced::widget::{Rule, rule}; /// Horizontal divider with default thickness #[must_use] diff --git a/src/widget/nav_bar.rs b/src/widget/nav_bar.rs index ad6f920..b7391ab 100644 --- a/src/widget/nav_bar.rs +++ b/src/widget/nav_bar.rs @@ -6,10 +6,9 @@ //! For details on the model, see the [`segmented_button`] module for more details. use apply::Apply; -use iced::{ - Background, Length, - clipboard::{dnd::DndAction, mime::AllowedMimeTypes}, -}; +use iced::clipboard::dnd::DndAction; +use iced::clipboard::mime::AllowedMimeTypes; +use iced::{Background, Length}; use iced_core::{Border, Color, Shadow}; use crate::widget::{Container, Icon, container, menu, scrollable, segmented_button}; diff --git a/src/widget/popover.rs b/src/widget/popover.rs index af5370a..57e4568 100644 --- a/src/widget/popover.rs +++ b/src/widget/popover.rs @@ -5,14 +5,10 @@ use iced::widget; use iced_core::event::{self, Event}; -use iced_core::layout; -use iced_core::mouse; -use iced_core::overlay; -use iced_core::renderer; -use iced_core::touch; use iced_core::widget::{Operation, Tree}; use iced_core::{ - Clipboard, Element, Layout, Length, Point, Rectangle, Shell, Size, Vector, Widget, + Clipboard, Element, Layout, Length, Point, Rectangle, Shell, Size, Vector, Widget, layout, + mouse, overlay, renderer, touch, }; pub use iced_widget::container::{Catalog, Style}; diff --git a/src/widget/progress_bar/circular.rs b/src/widget/progress_bar/circular.rs index 42c8e64..2123d2e 100644 --- a/src/widget/progress_bar/circular.rs +++ b/src/widget/progress_bar/circular.rs @@ -1,14 +1,10 @@ //! Show a circular progress indicator. use super::animation::{Animation, Progress}; use super::style::StyleSheet; -use iced::advanced::layout; -use iced::advanced::renderer; use iced::advanced::widget::tree::{self, Tree}; -use iced::advanced::{self, Clipboard, Layout, Shell, Widget}; -use iced::mouse; +use iced::advanced::{self, Clipboard, Layout, Shell, Widget, layout, renderer}; use iced::widget::canvas; -use iced::window; -use iced::{Element, Event, Length, Radians, Rectangle, Renderer, Size, Vector}; +use iced::{Element, Event, Length, Radians, Rectangle, Renderer, Size, Vector, mouse, window}; use std::f32::consts::PI; use std::time::Duration; diff --git a/src/widget/progress_bar/linear.rs b/src/widget/progress_bar/linear.rs index 7bcbb4f..7672579 100644 --- a/src/widget/progress_bar/linear.rs +++ b/src/widget/progress_bar/linear.rs @@ -1,13 +1,9 @@ //! Show a linear progress indicator. use super::animation::{Animation, Progress}; use super::style::StyleSheet; -use iced::advanced::layout; -use iced::advanced::renderer; use iced::advanced::widget::tree::{self, Tree}; -use iced::advanced::{self, Clipboard, Layout, Shell, Widget}; -use iced::mouse; -use iced::window; -use iced::{Background, Element, Event, Length, Rectangle, Size}; +use iced::advanced::{self, Clipboard, Layout, Shell, Widget, layout, renderer}; +use iced::{Background, Element, Event, Length, Rectangle, Size, mouse, window}; use std::time::Duration; diff --git a/src/widget/radio.rs b/src/widget/radio.rs index c3f115c..7e6ef42 100644 --- a/src/widget/radio.rs +++ b/src/widget/radio.rs @@ -2,14 +2,10 @@ use crate::{Theme, theme}; use iced::border; use iced_core::event::{self, Event}; -use iced_core::layout; -use iced_core::mouse; -use iced_core::overlay; -use iced_core::renderer; -use iced_core::touch; use iced_core::widget::tree::Tree; use iced_core::{ Border, Clipboard, Element, Layout, Length, Pixels, Rectangle, Shell, Size, Vector, Widget, + layout, mouse, overlay, renderer, touch, }; use iced_widget::radio as iced_radio; diff --git a/src/widget/rectangle_tracker/mod.rs b/src/widget/rectangle_tracker/mod.rs index b3066ec..839fa9a 100644 --- a/src/widget/rectangle_tracker/mod.rs +++ b/src/widget/rectangle_tracker/mod.rs @@ -6,13 +6,13 @@ use iced::widget::Container; pub use subscription::*; use iced_core::event::{self, Event}; -use iced_core::layout; -use iced_core::mouse; -use iced_core::overlay; -use iced_core::renderer; use iced_core::widget::Tree; -use iced_core::{Alignment, Clipboard, Element, Layout, Length, Padding, Rectangle, Shell, Widget}; -use std::{fmt::Debug, hash::Hash}; +use iced_core::{ + Alignment, Clipboard, Element, Layout, Length, Padding, Rectangle, Shell, Widget, layout, + mouse, overlay, renderer, +}; +use std::fmt::Debug; +use std::hash::Hash; pub use iced_widget::container::{Catalog, Style}; diff --git a/src/widget/rectangle_tracker/subscription.rs b/src/widget/rectangle_tracker/subscription.rs index 02fa432..22b4244 100644 --- a/src/widget/rectangle_tracker/subscription.rs +++ b/src/widget/rectangle_tracker/subscription.rs @@ -1,13 +1,10 @@ -use iced::{ - Rectangle, - futures::{ - StreamExt, - channel::mpsc::{UnboundedReceiver, unbounded}, - stream, - }, -}; +use iced::Rectangle; +use iced::futures::channel::mpsc::{UnboundedReceiver, unbounded}; +use iced::futures::{StreamExt, stream}; use iced_futures::Subscription; -use std::{collections::HashMap, fmt::Debug, hash::Hash}; +use std::collections::HashMap; +use std::fmt::Debug; +use std::hash::Hash; use super::RectangleTracker; diff --git a/src/widget/responsive_container.rs b/src/widget/responsive_container.rs index b9b6a28..c8925cc 100644 --- a/src/widget/responsive_container.rs +++ b/src/widget/responsive_container.rs @@ -2,12 +2,11 @@ use iced::{Limits, Size}; use iced_core::event::{self, Event}; -use iced_core::layout; -use iced_core::mouse; -use iced_core::overlay; -use iced_core::renderer; use iced_core::widget::{Id, Operation, Tree, tree}; -use iced_core::{Clipboard, Element, Layout, Length, Rectangle, Shell, Vector, Widget}; +use iced_core::{ + Clipboard, Element, Layout, Length, Rectangle, Shell, Vector, Widget, layout, mouse, overlay, + renderer, +}; pub(crate) fn responsive_container<'a, Message: 'static, Theme, E>( content: E, diff --git a/src/widget/responsive_menu_bar.rs b/src/widget/responsive_menu_bar.rs index b5dd556..2cae68d 100644 --- a/src/widget/responsive_menu_bar.rs +++ b/src/widget/responsive_menu_bar.rs @@ -2,10 +2,8 @@ use std::collections::HashMap; use apply::Apply; -use crate::{ - Core, Element, - widget::{button, icon, responsive_container}, -}; +use crate::widget::{button, icon, responsive_container}; +use crate::{Core, Element}; use super::menu::{self, ItemHeight, ItemWidth}; diff --git a/src/widget/segmented_button/widget.rs b/src/widget/segmented_button/widget.rs index fcb1c59..edd58eb 100644 --- a/src/widget/segmented_button/widget.rs +++ b/src/widget/segmented_button/widget.rs @@ -25,9 +25,11 @@ use iced_core::id::Internal; use iced_core::mouse::ScrollDelta; use iced_core::text::{self, Ellipsize, LineHeight, Renderer as TextRenderer, Shaping, Wrapping}; use iced_core::widget::operation::Focusable; -use iced_core::widget::{self, operation, tree}; -use iced_core::{Border, Point, Renderer as IcedRenderer, Shadow, Text}; -use iced_core::{Clipboard, Layout, Shell, Widget, layout, renderer, widget::Tree}; +use iced_core::widget::{self, Tree, operation, tree}; +use iced_core::{ + Border, Clipboard, Layout, Point, Renderer as IcedRenderer, Shadow, Shell, Text, Widget, + layout, renderer, +}; use iced_runtime::{Action, task}; use slotmap::{Key, SecondaryMap}; use std::borrow::Cow; diff --git a/src/widget/settings/item.rs b/src/widget/settings/item.rs index 5abb464..4eb5bb1 100644 --- a/src/widget/settings/item.rs +++ b/src/widget/settings/item.rs @@ -3,12 +3,11 @@ use std::borrow::Cow; -use crate::{ - Element, Theme, theme, - widget::{FlexRow, Row, column, container, flex_row, list, row, text}, -}; +use crate::widget::{FlexRow, Row, column, container, flex_row, list, row, text}; +use crate::{Element, Theme, theme}; use derive_setters::Setters; -use iced_core::{Length, text::Wrapping}; +use iced_core::Length; +use iced_core::text::Wrapping; use iced_widget::space; use taffy::AlignContent; diff --git a/src/widget/spin_button.rs b/src/widget/spin_button.rs index 833e90b..7193312 100644 --- a/src/widget/spin_button.rs +++ b/src/widget/spin_button.rs @@ -3,13 +3,10 @@ //! A control for incremental adjustments of a value. -use crate::{ - Element, theme, - widget::{button, column, container, icon, row, text}, -}; +use crate::widget::{button, column, container, icon, row, text}; +use crate::{Element, theme}; use apply::Apply; -use iced::{Alignment, Length}; -use iced::{Border, Shadow}; +use iced::{Alignment, Border, Length, Shadow}; use std::borrow::Cow; use std::ops::{Add, Sub}; diff --git a/src/widget/table/mod.rs b/src/widget/table/mod.rs index c546383..dfde381 100644 --- a/src/widget/table/mod.rs +++ b/src/widget/table/mod.rs @@ -2,12 +2,9 @@ //! pub mod model; -pub use model::{ - Entity, Model, - category::ItemCategory, - category::ItemInterface, - selection::{MultiSelect, SingleSelect}, -}; +pub use model::category::{ItemCategory, ItemInterface}; +pub use model::selection::{MultiSelect, SingleSelect}; +pub use model::{Entity, Model}; pub mod widget; pub use widget::compact::CompactTableView; pub use widget::standard::TableView; diff --git a/src/widget/table/model/entity.rs b/src/widget/table/model/entity.rs index 51c6060..910ccd2 100644 --- a/src/widget/table/model/entity.rs +++ b/src/widget/table/model/entity.rs @@ -3,10 +3,8 @@ use slotmap::{SecondaryMap, SparseSecondaryMap}; -use super::{ - Entity, Model, Selectable, - category::{ItemCategory, ItemInterface}, -}; +use super::category::{ItemCategory, ItemInterface}; +use super::{Entity, Model, Selectable}; /// A newly-inserted item which may have additional actions applied to it. pub struct EntityMut< diff --git a/src/widget/table/model/mod.rs b/src/widget/table/model/mod.rs index d6250ea..93998f9 100644 --- a/src/widget/table/model/mod.rs +++ b/src/widget/table/model/mod.rs @@ -2,10 +2,8 @@ pub mod category; pub mod entity; pub mod selection; -use std::{ - any::{Any, TypeId}, - collections::{HashMap, VecDeque}, -}; +use std::any::{Any, TypeId}; +use std::collections::{HashMap, VecDeque}; use category::{ItemCategory, ItemInterface}; use entity::EntityMut; diff --git a/src/widget/table/model/selection.rs b/src/widget/table/model/selection.rs index 20a0724..3e3d46b 100644 --- a/src/widget/table/model/selection.rs +++ b/src/widget/table/model/selection.rs @@ -3,10 +3,8 @@ //! Describes logic specific to the single-select and multi-select modes of a model. -use super::{ - Entity, Model, - category::{ItemCategory, ItemInterface}, -}; +use super::category::{ItemCategory, ItemInterface}; +use super::{Entity, Model}; use std::collections::HashSet; /// Describes a type that has selectable items. diff --git a/src/widget/table/widget/compact.rs b/src/widget/table/widget/compact.rs index 65ac905..6d027ca 100644 --- a/src/widget/table/widget/compact.rs +++ b/src/widget/table/widget/compact.rs @@ -1,14 +1,10 @@ use derive_setters::Setters; -use crate::widget::table::model::{ - Entity, Model, - category::{ItemCategory, ItemInterface}, - selection::Selectable, -}; -use crate::{ - Apply, Element, theme, - widget::{self, container, menu}, -}; +use crate::widget::table::model::category::{ItemCategory, ItemInterface}; +use crate::widget::table::model::selection::Selectable; +use crate::widget::table::model::{Entity, Model}; +use crate::widget::{self, container, menu}; +use crate::{Apply, Element, theme}; use iced::{Alignment, Border, Padding}; #[derive(Setters)] diff --git a/src/widget/table/widget/standard.rs b/src/widget/table/widget/standard.rs index 9ab76c9..0e20623 100644 --- a/src/widget/table/widget/standard.rs +++ b/src/widget/table/widget/standard.rs @@ -1,14 +1,10 @@ use derive_setters::Setters; -use crate::widget::table::model::{ - Entity, Model, - category::{ItemCategory, ItemInterface}, - selection::Selectable, -}; -use crate::{ - Apply, Element, theme, - widget::{self, container, divider, menu}, -}; +use crate::widget::table::model::category::{ItemCategory, ItemInterface}; +use crate::widget::table::model::selection::Selectable; +use crate::widget::table::model::{Entity, Model}; +use crate::widget::{self, container, divider, menu}; +use crate::{Apply, Element, theme}; use iced::{Alignment, Border, Length, Padding}; // THIS IS A PLACEHOLDER UNTIL A MORE SOPHISTICATED WIDGET CAN BE DEVELOPED diff --git a/src/widget/text_input/editor.rs b/src/widget/text_input/editor.rs index b814476..c9c2ca7 100644 --- a/src/widget/text_input/editor.rs +++ b/src/widget/text_input/editor.rs @@ -2,7 +2,8 @@ // Copyright 2023 System76 // SPDX-License-Identifier: MIT -use super::{cursor::Cursor, value::Value}; +use super::cursor::Cursor; +use super::value::Value; pub struct Editor<'a> { value: &'a mut Value, diff --git a/src/widget/text_input/input.rs b/src/widget/text_input/input.rs index 4336c75..ea1122e 100644 --- a/src/widget/text_input/input.rs +++ b/src/widget/text_input/input.rs @@ -28,18 +28,14 @@ use iced_core::overlay::Group; use iced_core::renderer::{self, Renderer as CoreRenderer}; use iced_core::text::{self, Affinity, Paragraph, Renderer, Text}; use iced_core::time::{Duration, Instant}; -use iced_core::touch; use iced_core::widget::Id; use iced_core::widget::operation::{self, Operation}; use iced_core::widget::tree::{self, Tree}; -use iced_core::window; -use iced_core::{Background, alignment}; -use iced_core::{Border, Shadow, keyboard}; use iced_core::{ - Clipboard, Color, Element, Layout, Length, Padding, Pixels, Point, Rectangle, Shell, Size, - Vector, Widget, + Background, Border, Clipboard, Color, Element, Layout, Length, Padding, Pixels, Point, + Rectangle, Shadow, Shell, Size, Vector, Widget, alignment, keyboard, layout, overlay, touch, + window, }; -use iced_core::{layout, overlay}; use iced_runtime::{Action, Task, task}; thread_local! { diff --git a/src/widget/text_input/style.rs b/src/widget/text_input/style.rs index 8af5e63..52b9878 100644 --- a/src/widget/text_input/style.rs +++ b/src/widget/text_input/style.rs @@ -4,7 +4,8 @@ //! Change the appearance of a text input. -use iced_core::{Background, Color, border::Radius}; +use iced_core::border::Radius; +use iced_core::{Background, Color}; /// The appearance of a text input. #[derive(Debug, Clone, Copy)] diff --git a/src/widget/toaster/mod.rs b/src/widget/toaster/mod.rs index bafaa9f..43acc5c 100644 --- a/src/widget/toaster/mod.rs +++ b/src/widget/toaster/mod.rs @@ -6,16 +6,13 @@ use std::collections::VecDeque; use std::rc::Rc; -use crate::widget::Column; -use crate::widget::container; +use crate::widget::{Column, container}; use iced::Task; use iced_core::Element; -use slotmap::SlotMap; -use slotmap::new_key_type; +use slotmap::{SlotMap, new_key_type}; use widget::Toaster; -use super::column; -use super::{button, icon, row, text}; +use super::{button, column, icon, row, text}; mod widget; diff --git a/src/widget/toaster/widget.rs b/src/widget/toaster/widget.rs index de47a9b..922c143 100644 --- a/src/widget/toaster/widget.rs +++ b/src/widget/toaster/widget.rs @@ -4,16 +4,14 @@ use iced::{Limits, Size}; use iced_core::layout::Node; -use iced_core::Element; -use iced_core::Overlay; use iced_core::event::{self, Event}; -use iced_core::layout; -use iced_core::mouse; -use iced_core::overlay; use iced_core::renderer::{self}; use iced_core::widget::Operation; use iced_core::widget::tree::Tree; -use iced_core::{Clipboard, Layout, Length, Point, Rectangle, Shell, Vector, Widget}; +use iced_core::{ + Clipboard, Element, Layout, Length, Overlay, Point, Rectangle, Shell, Vector, Widget, layout, + mouse, overlay, +}; pub struct Toaster<'a, Message, Theme, Renderer> { toasts: Element<'a, Message, Theme, Renderer>, diff --git a/src/widget/toggler.rs b/src/widget/toggler.rs index b95b596..2dad2ed 100644 --- a/src/widget/toggler.rs +++ b/src/widget/toggler.rs @@ -3,15 +3,14 @@ use std::time::{Duration, Instant}; use crate::{Element, anim}; +use iced_core::renderer::{self, Renderer}; +use iced_core::widget::{self, Tree, tree}; use iced_core::{ Border, Clipboard, Event, Layout, Length, Pixels, Rectangle, Shell, Size, Widget, alignment, - event, layout, mouse, - renderer::{self, Renderer}, - text, touch, - widget::{self, Tree, tree}, - window, + event, layout, mouse, text, touch, window, }; -use iced_widget::{Id, toggler::Status}; +use iced_widget::Id; +use iced_widget::toggler::Status; pub use iced_widget::toggler::{Catalog, Style}; diff --git a/src/widget/wayland/tooltip/mod.rs b/src/widget/wayland/tooltip/mod.rs index 947d1e8..aa80fad 100644 --- a/src/widget/wayland/tooltip/mod.rs +++ b/src/widget/wayland/tooltip/mod.rs @@ -5,7 +5,8 @@ pub mod widget; // Copyright 2023 System76 // SPDX-License-Identifier: MPL-2.0 -use iced_core::{Background, Color, Vector, border::Radius}; +use iced_core::border::Radius; +use iced_core::{Background, Color, Vector}; use crate::theme::THEME; diff --git a/src/widget/wayland/tooltip/widget.rs b/src/widget/wayland/tooltip/widget.rs index 7bf0991..203a201 100644 --- a/src/widget/wayland/tooltip/widget.rs +++ b/src/widget/wayland/tooltip/widget.rs @@ -14,16 +14,12 @@ use iced::Task; use iced_runtime::core::widget::Id; use iced_core::event::{self, Event}; -use iced_core::renderer; -use iced_core::touch; use iced_core::widget::Operation; use iced_core::widget::tree::{self, Tree}; use iced_core::{ - Background, Clipboard, Color, Layout, Length, Padding, Point, Rectangle, Shell, Vector, Widget, + Background, Border, Clipboard, Color, Layout, Length, Padding, Point, Rectangle, Shadow, Shell, + Vector, Widget, layout, mouse, overlay, renderer, svg, touch, }; -use iced_core::{Border, mouse}; -use iced_core::{Shadow, overlay}; -use iced_core::{layout, svg}; pub use super::{Catalog, Style}; diff --git a/src/widget/wrapper.rs b/src/widget/wrapper.rs index 133f9b8..aee06e5 100644 --- a/src/widget/wrapper.rs +++ b/src/widget/wrapper.rs @@ -1,13 +1,13 @@ -use std::{ - borrow::Borrow, - cell::RefCell, - rc::Rc, - thread::{self, ThreadId}, -}; +use std::borrow::Borrow; +use std::cell::RefCell; +use std::rc::Rc; +use std::thread::{self, ThreadId}; use crate::Element; use iced::{Length, Rectangle, Size, event}; -use iced_core::{Widget, id::Id, widget, widget::tree}; +use iced_core::id::Id; +use iced_core::widget::tree; +use iced_core::{Widget, widget}; #[derive(Debug)] pub struct RcWrapper {