diff options
author | 2025-02-21 01:22:56 +0100 | |
---|---|---|
committer | 2025-02-21 01:37:13 +0100 | |
commit | 9ceb467e6e12129b42d67a4a1ff3cb21bc7daadd (patch) | |
tree | dd8a9407058915c152ce6544ba20b75240ca85be | |
parent | 28caeccf22d163e9014b5ed26334b6085683a28b (diff) | |
download | iced-9ceb467e6e12129b42d67a4a1ff3cb21bc7daadd.tar.gz iced-9ceb467e6e12129b42d67a4a1ff3cb21bc7daadd.tar.bz2 iced-9ceb467e6e12129b42d67a4a1ff3cb21bc7daadd.zip |
Run `cargo fmt`
59 files changed, 98 insertions, 96 deletions
diff --git a/benches/wgpu.rs b/benches/wgpu.rs index 0605294f..de19c4cf 100644 --- a/benches/wgpu.rs +++ b/benches/wgpu.rs @@ -1,5 +1,5 @@ #![allow(missing_docs)] -use criterion::{criterion_group, criterion_main, Bencher, Criterion}; +use criterion::{Bencher, Criterion, criterion_group, criterion_main}; use iced::alignment; use iced::mouse; diff --git a/core/src/background.rs b/core/src/background.rs index c8b7cbea..1f665ef4 100644 --- a/core/src/background.rs +++ b/core/src/background.rs @@ -1,5 +1,5 @@ -use crate::gradient::{self, Gradient}; use crate::Color; +use crate::gradient::{self, Gradient}; /// The background of some element. #[derive(Debug, Clone, Copy, PartialEq)] diff --git a/core/src/color.rs b/core/src/color.rs index a2e076ae..a9183776 100644 --- a/core/src/color.rs +++ b/core/src/color.rs @@ -227,12 +227,8 @@ macro_rules! color { ($r:expr, $g:expr, $b:expr) => { $crate::Color::from_rgb8($r, $g, $b) }; - ($r:expr, $g:expr, $b:expr, $a:expr) => {{ - $crate::Color::from_rgba8($r, $g, $b, $a) - }}; - ($hex:expr) => {{ - $crate::color!($hex, 1.0) - }}; + ($r:expr, $g:expr, $b:expr, $a:expr) => {{ $crate::Color::from_rgba8($r, $g, $b, $a) }}; + ($hex:expr) => {{ $crate::color!($hex, 1.0) }}; ($hex:expr, $a:expr) => {{ let hex = $hex as u32; diff --git a/core/src/keyboard/event.rs b/core/src/keyboard/event.rs index 6e483f5b..88c57b21 100644 --- a/core/src/keyboard/event.rs +++ b/core/src/keyboard/event.rs @@ -1,6 +1,6 @@ +use crate::SmolStr; use crate::keyboard::key; use crate::keyboard::{Key, Location, Modifiers}; -use crate::SmolStr; /// A keyboard event. /// diff --git a/core/src/shell.rs b/core/src/shell.rs index 56250e2e..e3fcdf89 100644 --- a/core/src/shell.rs +++ b/core/src/shell.rs @@ -1,6 +1,6 @@ +use crate::InputMethod; use crate::event; use crate::window; -use crate::InputMethod; /// A connection to the state of a shell. /// diff --git a/core/src/theme/palette.rs b/core/src/theme/palette.rs index b69f99b1..b4acaa83 100644 --- a/core/src/theme/palette.rs +++ b/core/src/theme/palette.rs @@ -1,5 +1,5 @@ //! Define the colors of a theme. -use crate::{color, Color}; +use crate::{Color, color}; use palette::color_difference::Wcag21RelativeContrast; use palette::rgb::Rgb; diff --git a/core/src/widget/operation/focusable.rs b/core/src/widget/operation/focusable.rs index a1327bc1..1ee41244 100644 --- a/core/src/widget/operation/focusable.rs +++ b/core/src/widget/operation/focusable.rs @@ -1,7 +1,7 @@ //! Operate on widgets that can be focused. -use crate::widget::operation::{self, Operation, Outcome}; -use crate::widget::Id; use crate::Rectangle; +use crate::widget::Id; +use crate::widget::operation::{self, Operation, Outcome}; /// The internal state of a widget that can be focused. pub trait Focusable { diff --git a/core/src/widget/operation/text_input.rs b/core/src/widget/operation/text_input.rs index a46f1a2d..efb2a4d3 100644 --- a/core/src/widget/operation/text_input.rs +++ b/core/src/widget/operation/text_input.rs @@ -1,7 +1,7 @@ //! Operate on widgets that have text input. -use crate::widget::operation::Operation; -use crate::widget::Id; use crate::Rectangle; +use crate::widget::Id; +use crate::widget::operation::Operation; /// The internal state of a widget that has text input. pub trait TextInput { diff --git a/core/src/window/settings.rs b/core/src/window/settings.rs index 9432eaaa..94bcfd78 100644 --- a/core/src/window/settings.rs +++ b/core/src/window/settings.rs @@ -24,8 +24,8 @@ mod platform; #[path = "settings/other.rs"] mod platform; -use crate::window::{Icon, Level, Position}; use crate::Size; +use crate::window::{Icon, Level, Position}; pub use platform::PlatformSpecific; diff --git a/futures/src/backend/native/tokio.rs b/futures/src/backend/native/tokio.rs index c38ef566..0fd5da41 100644 --- a/futures/src/backend/native/tokio.rs +++ b/futures/src/backend/native/tokio.rs @@ -22,9 +22,9 @@ impl crate::Executor for Executor { pub mod time { //! Listen and react to time. + use crate::MaybeSend; use crate::core::time::{Duration, Instant}; use crate::subscription::Subscription; - use crate::MaybeSend; use futures::stream; use std::future::Future; diff --git a/futures/src/event.rs b/futures/src/event.rs index 72ea78ad..bd75d82c 100644 --- a/futures/src/event.rs +++ b/futures/src/event.rs @@ -1,8 +1,8 @@ //! Listen to runtime events. +use crate::MaybeSend; use crate::core::event::{self, Event}; use crate::core::window; use crate::subscription::{self, Subscription}; -use crate::MaybeSend; /// Returns a [`Subscription`] to all the ignored runtime events. /// diff --git a/futures/src/keyboard.rs b/futures/src/keyboard.rs index 35f6b6fa..036edb9c 100644 --- a/futures/src/keyboard.rs +++ b/futures/src/keyboard.rs @@ -1,9 +1,9 @@ //! Listen to keyboard events. +use crate::MaybeSend; use crate::core; use crate::core::event; use crate::core::keyboard::{Event, Key, Modifiers}; use crate::subscription::{self, Subscription}; -use crate::MaybeSend; /// Listens to keyboard key presses and calls the given function /// to map them into actual messages. diff --git a/futures/src/runtime.rs b/futures/src/runtime.rs index 157e2c67..0f30b469 100644 --- a/futures/src/runtime.rs +++ b/futures/src/runtime.rs @@ -2,7 +2,7 @@ use crate::subscription; use crate::{BoxFuture, BoxStream, Executor, MaybeSend}; -use futures::{channel::mpsc, Sink}; +use futures::{Sink, channel::mpsc}; use std::marker::PhantomData; /// A batteries-included runtime of commands and subscriptions. diff --git a/graphics/src/compositor.rs b/graphics/src/compositor.rs index 0b862bdb..fadf41d9 100644 --- a/graphics/src/compositor.rs +++ b/graphics/src/compositor.rs @@ -120,9 +120,7 @@ pub trait Default { #[derive(Clone, PartialEq, Eq, Debug, Error)] pub enum SurfaceError { /// A timeout was encountered while trying to acquire the next frame. - #[error( - "A timeout was encountered while trying to acquire the next frame" - )] + #[error("A timeout was encountered while trying to acquire the next frame")] Timeout, /// The underlying surface has changed, and therefore the surface must be updated. #[error( diff --git a/graphics/src/geometry/path/builder.rs b/graphics/src/geometry/path/builder.rs index 44410f6d..e814a3a7 100644 --- a/graphics/src/geometry/path/builder.rs +++ b/graphics/src/geometry/path/builder.rs @@ -1,4 +1,4 @@ -use crate::geometry::path::{arc, Arc, Path}; +use crate::geometry::path::{Arc, Path, arc}; use crate::core::border; use crate::core::{Point, Radians, Size}; @@ -171,8 +171,12 @@ impl Builder { radius: border::Radius, ) { let min_size = (size.height / 2.0).min(size.width / 2.0); - let [top_left_corner, top_right_corner, bottom_right_corner, bottom_left_corner] = - radius.into(); + let [ + top_left_corner, + top_right_corner, + bottom_right_corner, + bottom_left_corner, + ] = radius.into(); self.move_to(Point::new( top_left.x + min_size.min(top_left_corner), diff --git a/graphics/src/image.rs b/graphics/src/image.rs index 67a5e0cf..171edd80 100644 --- a/graphics/src/image.rs +++ b/graphics/src/image.rs @@ -2,9 +2,9 @@ #[cfg(feature = "image")] pub use ::image as image_rs; +use crate::core::Rectangle; use crate::core::image; use crate::core::svg; -use crate::core::Rectangle; /// A raster or vector image. #[derive(Debug, Clone, PartialEq)] diff --git a/graphics/src/settings.rs b/graphics/src/settings.rs index 2e8275c6..118ed73b 100644 --- a/graphics/src/settings.rs +++ b/graphics/src/settings.rs @@ -1,5 +1,5 @@ -use crate::core::{Font, Pixels}; use crate::Antialiasing; +use crate::core::{Font, Pixels}; /// The settings of a renderer. #[derive(Debug, Clone, Copy, PartialEq)] diff --git a/highlighter/src/lib.rs b/highlighter/src/lib.rs index 2d0ac2e4..982f1279 100644 --- a/highlighter/src/lib.rs +++ b/highlighter/src/lib.rs @@ -1,9 +1,9 @@ //! A syntax highlighter for iced. use iced_core as core; +use crate::core::Color; use crate::core::font::{self, Font}; use crate::core::text::highlighter::{self, Format}; -use crate::core::Color; use std::ops::Range; use std::sync::LazyLock; diff --git a/renderer/src/fallback.rs b/renderer/src/fallback.rs index 52b8317f..82fc74ed 100644 --- a/renderer/src/fallback.rs +++ b/renderer/src/fallback.rs @@ -74,10 +74,10 @@ impl<A, B> core::text::Renderer for Renderer<A, B> where A: core::text::Renderer, B: core::text::Renderer< - Font = A::Font, - Paragraph = A::Paragraph, - Editor = A::Editor, - >, + Font = A::Font, + Paragraph = A::Paragraph, + Editor = A::Editor, + >, { type Font = A::Font; type Paragraph = A::Paragraph; diff --git a/runtime/src/font.rs b/runtime/src/font.rs index 75fdfc11..2d73566d 100644 --- a/runtime/src/font.rs +++ b/runtime/src/font.rs @@ -1,6 +1,6 @@ //! Load and use fonts. -use crate::task::{self, Task}; use crate::Action; +use crate::task::{self, Task}; use std::borrow::Cow; /// An error while loading a font. diff --git a/runtime/src/multi_window/program.rs b/runtime/src/multi_window/program.rs index e8c71b26..4ea44791 100644 --- a/runtime/src/multi_window/program.rs +++ b/runtime/src/multi_window/program.rs @@ -1,8 +1,8 @@ //! Build interactive programs using The Elm Architecture. +use crate::Task; use crate::core::text; use crate::core::window; use crate::core::{Element, Renderer}; -use crate::Task; /// The core of a user interface for a multi-window application following The Elm Architecture. pub trait Program: Sized { diff --git a/runtime/src/program.rs b/runtime/src/program.rs index 77acf497..964157db 100644 --- a/runtime/src/program.rs +++ b/runtime/src/program.rs @@ -1,8 +1,8 @@ //! Build interactive programs using The Elm Architecture. use crate::Task; -use iced_core::text; use iced_core::Element; +use iced_core::text; mod state; diff --git a/runtime/src/task.rs b/runtime/src/task.rs index 022483f7..105a4135 100644 --- a/runtime/src/task.rs +++ b/runtime/src/task.rs @@ -1,17 +1,17 @@ //! Create runtime tasks. +use crate::Action; use crate::core::widget; use crate::futures::futures::channel::mpsc; use crate::futures::futures::channel::oneshot; use crate::futures::futures::future::{self, FutureExt}; use crate::futures::futures::stream::{self, Stream, StreamExt}; -use crate::futures::{boxed_stream, BoxStream, MaybeSend}; -use crate::Action; +use crate::futures::{BoxStream, MaybeSend, boxed_stream}; use std::future::Future; use std::sync::Arc; #[doc(no_inline)] -pub use sipper::{sipper, stream, Never, Sender, Sipper, Straw}; +pub use sipper::{Never, Sender, Sipper, Straw, sipper, stream}; /// A set of concurrent actions to be performed by the iced runtime. /// diff --git a/runtime/src/window.rs b/runtime/src/window.rs index 183fab97..ccd8721b 100644 --- a/runtime/src/window.rs +++ b/runtime/src/window.rs @@ -5,9 +5,9 @@ use crate::core::window::{ UserAttention, }; use crate::core::{Point, Size}; +use crate::futures::Subscription; use crate::futures::event; use crate::futures::futures::channel::oneshot; -use crate::futures::Subscription; use crate::task::{self, Task}; pub use raw_window_handle; diff --git a/src/advanced.rs b/src/advanced.rs index 843b381a..ac88776e 100644 --- a/src/advanced.rs +++ b/src/advanced.rs @@ -2,8 +2,8 @@ pub mod subscription { //! Write your own subscriptions. pub use crate::runtime::futures::subscription::{ - from_recipe, into_recipes, Event, EventStream, Hasher, MacOS, - PlatformSpecific, Recipe, + Event, EventStream, Hasher, MacOS, PlatformSpecific, Recipe, + from_recipe, into_recipes, }; } @@ -13,6 +13,7 @@ pub mod widget { pub use crate::runtime::task::widget as operate; } +pub use crate::core::Shell; pub use crate::core::clipboard::{self, Clipboard}; pub use crate::core::image; pub use crate::core::layout::{self, Layout}; @@ -21,6 +22,5 @@ pub use crate::core::overlay::{self, Overlay}; pub use crate::core::renderer::{self, Renderer}; pub use crate::core::svg; pub use crate::core::text::{self, Text}; -pub use crate::core::Shell; pub use crate::renderer::graphics; pub use widget::Widget; @@ -505,22 +505,22 @@ pub use crate::core::gradient; pub use crate::core::padding; pub use crate::core::theme; pub use crate::core::{ - never, Alignment, Animation, Background, Border, Color, ContentFit, - Degrees, Function, Gradient, Length, Padding, Pixels, Point, Radians, - Rectangle, Rotation, Settings, Shadow, Size, Theme, Transformation, Vector, + Alignment, Animation, Background, Border, Color, ContentFit, Degrees, + Function, Gradient, Length, Padding, Pixels, Point, Radians, Rectangle, + Rotation, Settings, Shadow, Size, Theme, Transformation, Vector, never, }; pub use crate::runtime::exit; pub use iced_futures::Subscription; -pub use alignment::Horizontal::{Left, Right}; -pub use alignment::Vertical::{Bottom, Top}; pub use Alignment::Center; pub use Length::{Fill, FillPortion, Shrink}; +pub use alignment::Horizontal::{Left, Right}; +pub use alignment::Vertical::{Bottom, Top}; pub mod task { //! Create runtime tasks. pub use crate::runtime::task::{ - sipper, stream, Handle, Never, Sipper, Straw, Task, + Handle, Never, Sipper, Straw, Task, sipper, stream, }; } @@ -683,7 +683,7 @@ pub fn run<State, Message, Theme, Renderer>( title: impl application::Title<State> + 'static, update: impl application::Update<State, Message> + 'static, view: impl for<'a> application::View<'a, State, Message, Theme, Renderer> - + 'static, + + 'static, ) -> Result where State: Default + 'static, diff --git a/tiny_skia/src/engine.rs b/tiny_skia/src/engine.rs index 196c36cf..c1c02376 100644 --- a/tiny_skia/src/engine.rs +++ b/tiny_skia/src/engine.rs @@ -1,10 +1,10 @@ +use crate::Primitive; use crate::core::renderer::Quad; use crate::core::{ Background, Color, Gradient, Rectangle, Size, Transformation, Vector, }; use crate::graphics::{Image, Text}; use crate::text; -use crate::Primitive; #[derive(Debug)] pub struct Engine { diff --git a/tiny_skia/src/geometry.rs b/tiny_skia/src/geometry.rs index 681bf25d..dbdff444 100644 --- a/tiny_skia/src/geometry.rs +++ b/tiny_skia/src/geometry.rs @@ -1,3 +1,4 @@ +use crate::Primitive; use crate::core::text::LineHeight; use crate::core::{self, Pixels, Point, Radians, Rectangle, Size, Svg, Vector}; use crate::graphics::cache::{self, Cached}; @@ -5,7 +6,6 @@ use crate::graphics::geometry::fill::{self, Fill}; use crate::graphics::geometry::stroke::{self, Stroke}; use crate::graphics::geometry::{self, Path, Style}; use crate::graphics::{self, Gradient, Image, Text}; -use crate::Primitive; use std::rc::Rc; diff --git a/tiny_skia/src/layer.rs b/tiny_skia/src/layer.rs index bdfd4d38..444efb84 100644 --- a/tiny_skia/src/layer.rs +++ b/tiny_skia/src/layer.rs @@ -1,3 +1,4 @@ +use crate::Primitive; use crate::core::renderer::Quad; use crate::core::{ self, Background, Color, Point, Rectangle, Svg, Transformation, @@ -6,7 +7,6 @@ use crate::graphics::damage; use crate::graphics::layer; use crate::graphics::text::{Editor, Paragraph, Text}; use crate::graphics::{self, Image}; -use crate::Primitive; use std::rc::Rc; diff --git a/tiny_skia/src/lib.rs b/tiny_skia/src/lib.rs index a42f1de4..b73eb842 100644 --- a/tiny_skia/src/lib.rs +++ b/tiny_skia/src/lib.rs @@ -32,9 +32,9 @@ use crate::core::{ Background, Color, Font, Pixels, Point, Rectangle, Size, Transformation, }; use crate::engine::Engine; +use crate::graphics::Viewport; use crate::graphics::compositor; use crate::graphics::text::{Editor, Paragraph}; -use crate::graphics::Viewport; /// A [`tiny-skia`] graphics renderer for [`iced`]. /// diff --git a/wgpu/src/geometry.rs b/wgpu/src/geometry.rs index d2ffda53..8d161015 100644 --- a/wgpu/src/geometry.rs +++ b/wgpu/src/geometry.rs @@ -713,7 +713,7 @@ fn into_fill_rule(rule: fill::Rule) -> lyon::tessellation::FillRule { pub(super) fn dashed(path: &Path, line_dash: LineDash<'_>) -> Path { use lyon::algorithms::walk::{ - walk_along_path, RepeatedPattern, WalkerEvent, + RepeatedPattern, WalkerEvent, walk_along_path, }; use lyon::path::iterator::PathIterator; diff --git a/wgpu/src/image/mod.rs b/wgpu/src/image/mod.rs index caac0813..6cb18a07 100644 --- a/wgpu/src/image/mod.rs +++ b/wgpu/src/image/mod.rs @@ -9,8 +9,8 @@ mod raster; #[cfg(feature = "svg")] mod vector; -use crate::core::{Rectangle, Size, Transformation}; use crate::Buffer; +use crate::core::{Rectangle, Size, Transformation}; use bytemuck::{Pod, Zeroable}; diff --git a/wgpu/src/image/raster.rs b/wgpu/src/image/raster.rs index 4d3c3125..83777807 100644 --- a/wgpu/src/image/raster.rs +++ b/wgpu/src/image/raster.rs @@ -1,5 +1,5 @@ -use crate::core::image; use crate::core::Size; +use crate::core::image; use crate::graphics; use crate::graphics::image::image_rs; use crate::image::atlas::{self, Atlas}; diff --git a/wgpu/src/layer.rs b/wgpu/src/layer.rs index 68d5a015..2255b3f2 100644 --- a/wgpu/src/layer.rs +++ b/wgpu/src/layer.rs @@ -1,11 +1,11 @@ use crate::core::{ - self, renderer, Background, Color, Point, Rectangle, Svg, Transformation, + self, Background, Color, Point, Rectangle, Svg, Transformation, renderer, }; use crate::graphics; +use crate::graphics::Mesh; use crate::graphics::color; use crate::graphics::layer; use crate::graphics::text::{Editor, Paragraph}; -use crate::graphics::Mesh; use crate::image::{self, Image}; use crate::primitive::{self, Primitive}; use crate::quad::{self, Quad}; diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs index b1998da7..2ef9992c 100644 --- a/wgpu/src/lib.rs +++ b/wgpu/src/lib.rs @@ -64,8 +64,8 @@ use crate::core::{ Background, Color, Font, Pixels, Point, Rectangle, Size, Transformation, Vector, }; -use crate::graphics::text::{Editor, Paragraph}; use crate::graphics::Viewport; +use crate::graphics::text::{Editor, Paragraph}; /// A [`wgpu`] graphics renderer for [`iced`]. /// @@ -403,9 +403,9 @@ impl Renderer { overlay: &[impl AsRef<str>], viewport: &Viewport, ) { + use crate::core::Renderer as _; use crate::core::alignment; use crate::core::text::Renderer as _; - use crate::core::Renderer as _; self.with_layer( Rectangle::with_size(viewport.logical_size()), diff --git a/wgpu/src/quad/gradient.rs b/wgpu/src/quad/gradient.rs index 3d4ca4db..68c11157 100644 --- a/wgpu/src/quad/gradient.rs +++ b/wgpu/src/quad/gradient.rs @@ -1,6 +1,6 @@ +use crate::Buffer; use crate::graphics::gradient; use crate::quad::{self, Quad}; -use crate::Buffer; use bytemuck::{Pod, Zeroable}; use std::ops::Range; diff --git a/wgpu/src/quad/solid.rs b/wgpu/src/quad/solid.rs index f3e85ce7..b6d88486 100644 --- a/wgpu/src/quad/solid.rs +++ b/wgpu/src/quad/solid.rs @@ -1,6 +1,6 @@ +use crate::Buffer; use crate::graphics::color; use crate::quad::{self, Quad}; -use crate::Buffer; use bytemuck::{Pod, Zeroable}; use std::ops::Range; diff --git a/wgpu/src/text.rs b/wgpu/src/text.rs index 591bc0b7..33fbd4dc 100644 --- a/wgpu/src/text.rs +++ b/wgpu/src/text.rs @@ -3,7 +3,7 @@ use crate::core::{Rectangle, Size, Transformation}; use crate::graphics::cache; use crate::graphics::color; use crate::graphics::text::cache::{self as text_cache, Cache as BufferCache}; -use crate::graphics::text::{font_system, to_color, Editor, Paragraph}; +use crate::graphics::text::{Editor, Paragraph, font_system, to_color}; use rustc_hash::FxHashMap; use std::collections::hash_map; diff --git a/wgpu/src/triangle.rs b/wgpu/src/triangle.rs index ab88be3b..a2b976ea 100644 --- a/wgpu/src/triangle.rs +++ b/wgpu/src/triangle.rs @@ -1,10 +1,10 @@ //! Draw meshes of triangles. mod msaa; +use crate::Buffer; use crate::core::{Rectangle, Size, Transformation}; -use crate::graphics::mesh::{self, Mesh}; use crate::graphics::Antialiasing; -use crate::Buffer; +use crate::graphics::mesh::{self, Mesh}; use rustc_hash::FxHashMap; use std::collections::hash_map; @@ -644,10 +644,10 @@ impl Uniforms { } mod solid { - use crate::graphics::mesh; + use crate::Buffer; use crate::graphics::Antialiasing; + use crate::graphics::mesh; use crate::triangle; - use crate::Buffer; #[derive(Debug)] pub struct Pipeline { @@ -795,11 +795,11 @@ mod solid { } mod gradient { + use crate::Buffer; + use crate::graphics::Antialiasing; use crate::graphics::color; use crate::graphics::mesh; - use crate::graphics::Antialiasing; use crate::triangle; - use crate::Buffer; #[derive(Debug)] pub struct Pipeline { diff --git a/widget/src/button.rs b/widget/src/button.rs index 0e24328f..1b51065d 100644 --- a/widget/src/button.rs +++ b/widget/src/button.rs @@ -23,8 +23,8 @@ use crate::core::overlay; use crate::core::renderer; use crate::core::theme::palette; use crate::core::touch; -use crate::core::widget::tree::{self, Tree}; use crate::core::widget::Operation; +use crate::core::widget::tree::{self, Tree}; use crate::core::window; use crate::core::{ Background, Clipboard, Color, Element, Event, Layout, Length, Padding, diff --git a/widget/src/canvas.rs b/widget/src/canvas.rs index 046abddf..50acade5 100644 --- a/widget/src/canvas.rs +++ b/widget/src/canvas.rs @@ -52,13 +52,13 @@ mod program; pub use program::Program; +pub use crate::Action; pub use crate::core::event::Event; pub use crate::graphics::cache::Group; pub use crate::graphics::geometry::{ - fill, gradient, path, stroke, Fill, Gradient, Image, LineCap, LineDash, - LineJoin, Path, Stroke, Style, Text, + Fill, Gradient, Image, LineCap, LineDash, LineJoin, Path, Stroke, Style, + Text, fill, gradient, path, stroke, }; -pub use crate::Action; use crate::core::event; use crate::core::layout::{self, Layout}; diff --git a/widget/src/canvas/program.rs b/widget/src/canvas/program.rs index 43446b64..9644f676 100644 --- a/widget/src/canvas/program.rs +++ b/widget/src/canvas/program.rs @@ -1,8 +1,8 @@ +use crate::Action; use crate::canvas::mouse; use crate::canvas::{Event, Geometry}; use crate::core::Rectangle; use crate::graphics::geometry; -use crate::Action; /// The state and logic of a [`Canvas`]. /// diff --git a/widget/src/container.rs b/widget/src/container.rs index 86c1c7a8..da5b436f 100644 --- a/widget/src/container.rs +++ b/widget/src/container.rs @@ -30,9 +30,9 @@ use crate::core::theme; use crate::core::widget::tree::{self, Tree}; use crate::core::widget::{self, Operation}; use crate::core::{ - self, color, Background, Clipboard, Color, Element, Event, Layout, Length, + self, Background, Clipboard, Color, Element, Event, Layout, Length, Padding, Pixels, Point, Rectangle, Shadow, Shell, Size, Theme, Vector, - Widget, + Widget, color, }; use crate::runtime::task::{self, Task}; diff --git a/widget/src/helpers.rs b/widget/src/helpers.rs index 42d0f499..118a2414 100644 --- a/widget/src/helpers.rs +++ b/widget/src/helpers.rs @@ -14,8 +14,8 @@ use crate::pick_list::{self, PickList}; use crate::progress_bar::{self, ProgressBar}; use crate::radio::{self, Radio}; use crate::rule::{self, Rule}; -use crate::runtime::task::{self, Task}; use crate::runtime::Action; +use crate::runtime::task::{self, Task}; use crate::scrollable::{self, Scrollable}; use crate::slider::{self, Slider}; use crate::text::{self, Text}; diff --git a/widget/src/keyed/column.rs b/widget/src/keyed/column.rs index 313b728a..3064a8c4 100644 --- a/widget/src/keyed/column.rs +++ b/widget/src/keyed/column.rs @@ -3,8 +3,8 @@ use crate::core::layout; use crate::core::mouse; use crate::core::overlay; use crate::core::renderer; -use crate::core::widget::tree::{self, Tree}; use crate::core::widget::Operation; +use crate::core::widget::tree::{self, Tree}; use crate::core::{ Alignment, Clipboard, Element, Event, Layout, Length, Padding, Pixels, Rectangle, Shell, Size, Vector, Widget, diff --git a/widget/src/lazy.rs b/widget/src/lazy.rs index 6df026de..8b7b38ce 100644 --- a/widget/src/lazy.rs +++ b/widget/src/lazy.rs @@ -10,13 +10,13 @@ pub use responsive::Responsive; mod cache; +use crate::core::Element; use crate::core::layout::{self, Layout}; use crate::core::mouse; use crate::core::overlay; use crate::core::renderer; use crate::core::widget::tree::{self, Tree}; use crate::core::widget::{self, Widget}; -use crate::core::Element; use crate::core::{ self, Clipboard, Event, Length, Point, Rectangle, Shell, Size, Vector, }; diff --git a/widget/src/lazy/cache.rs b/widget/src/lazy/cache.rs index b341c234..367eefda 100644 --- a/widget/src/lazy/cache.rs +++ b/widget/src/lazy/cache.rs @@ -1,6 +1,6 @@ #![allow(dead_code)] -use crate::core::overlay; use crate::core::Element; +use crate::core::overlay; use ouroboros::self_referencing; diff --git a/widget/src/markdown.rs b/widget/src/markdown.rs index ad4b81fe..d4de2a8c 100644 --- a/widget/src/markdown.rs +++ b/widget/src/markdown.rs @@ -48,7 +48,7 @@ use crate::core::font::{self, Font}; use crate::core::padding; use crate::core::theme; use crate::core::{ - self, color, Color, Element, Length, Padding, Pixels, Theme, + self, Color, Element, Length, Padding, Pixels, Theme, color, }; use crate::{column, container, rich_text, row, scrollable, span, text}; diff --git a/widget/src/mouse_area.rs b/widget/src/mouse_area.rs index c1c3ba0f..10976c76 100644 --- a/widget/src/mouse_area.rs +++ b/widget/src/mouse_area.rs @@ -4,7 +4,7 @@ use crate::core::mouse; use crate::core::overlay; use crate::core::renderer; use crate::core::touch; -use crate::core::widget::{tree, Operation, Tree}; +use crate::core::widget::{Operation, Tree, tree}; use crate::core::{ Clipboard, Element, Event, Layout, Length, Point, Rectangle, Shell, Size, Vector, Widget, diff --git a/widget/src/qr_code.rs b/widget/src/qr_code.rs index 458f3588..07bb0c50 100644 --- a/widget/src/qr_code.rs +++ b/widget/src/qr_code.rs @@ -20,6 +20,7 @@ //! qr_code(&state.data).into() //! } //! ``` +use crate::Renderer; use crate::canvas; use crate::core::layout; use crate::core::mouse; @@ -29,7 +30,6 @@ use crate::core::{ Color, Element, Layout, Length, Pixels, Point, Rectangle, Size, Theme, Vector, Widget, }; -use crate::Renderer; use std::cell::RefCell; use thiserror::Error; diff --git a/widget/src/scrollable.rs b/widget/src/scrollable.rs index 0cf75c04..0c876036 100644 --- a/widget/src/scrollable.rs +++ b/widget/src/scrollable.rs @@ -37,8 +37,8 @@ use crate::core::{ Length, Padding, Pixels, Point, Rectangle, Shell, Size, Theme, Vector, Widget, }; -use crate::runtime::task::{self, Task}; use crate::runtime::Action; +use crate::runtime::task::{self, Task}; pub use operation::scrollable::{AbsoluteOffset, RelativeOffset}; diff --git a/widget/src/shader.rs b/widget/src/shader.rs index 06254a1c..6d532e59 100644 --- a/widget/src/shader.rs +++ b/widget/src/shader.rs @@ -14,8 +14,8 @@ use crate::renderer::wgpu::primitive; use std::marker::PhantomData; -pub use crate::graphics::Viewport; pub use crate::Action; +pub use crate::graphics::Viewport; pub use primitive::{Primitive, Storage}; /// A widget which can render custom shaders with Iced's `wgpu` backend. diff --git a/widget/src/shader/program.rs b/widget/src/shader/program.rs index 81ecc9b1..bbea937c 100644 --- a/widget/src/shader/program.rs +++ b/widget/src/shader/program.rs @@ -1,5 +1,5 @@ -use crate::core::mouse; use crate::core::Rectangle; +use crate::core::mouse; use crate::renderer::wgpu::Primitive; use crate::shader::{self, Action}; diff --git a/widget/src/text_input.rs b/widget/src/text_input.rs index ae3dfe4c..697d0d64 100644 --- a/widget/src/text_input.rs +++ b/widget/src/text_input.rs @@ -60,8 +60,8 @@ use crate::core::{ Background, Border, Color, Element, Event, InputMethod, Layout, Length, Padding, Pixels, Point, Rectangle, Shell, Size, Theme, Vector, Widget, }; -use crate::runtime::task::{self, Task}; use crate::runtime::Action; +use crate::runtime::task::{self, Task}; /// A field that can be filled with text. /// diff --git a/widget/src/themer.rs b/widget/src/themer.rs index 4e583882..cf0845be 100644 --- a/widget/src/themer.rs +++ b/widget/src/themer.rs @@ -3,8 +3,8 @@ use crate::core::layout; use crate::core::mouse; use crate::core::overlay; use crate::core::renderer; -use crate::core::widget::tree::{self, Tree}; use crate::core::widget::Operation; +use crate::core::widget::tree::{self, Tree}; use crate::core::{ Background, Clipboard, Color, Element, Event, Layout, Length, Point, Rectangle, Shell, Size, Vector, Widget, diff --git a/widget/src/tooltip.rs b/widget/src/tooltip.rs index 5bebeeac..2d674bca 100644 --- a/widget/src/tooltip.rs +++ b/widget/src/tooltip.rs @@ -470,8 +470,10 @@ where layout::Node::with_children( tooltip_bounds.size(), - vec![tooltip_layout - .translate(Vector::new(self.padding, self.padding))], + vec![ + tooltip_layout + .translate(Vector::new(self.padding, self.padding)), + ], ) .translate(Vector::new(tooltip_bounds.x, tooltip_bounds.y)) } diff --git a/winit/src/program.rs b/winit/src/program.rs index 9a64fa51..c57c0b1b 100644 --- a/winit/src/program.rs +++ b/winit/src/program.rs @@ -20,9 +20,9 @@ use crate::futures::futures::{Future, StreamExt}; use crate::futures::subscription::{self, Subscription}; use crate::futures::{Executor, Runtime}; use crate::graphics; -use crate::graphics::{compositor, Compositor}; -use crate::runtime::user_interface::{self, UserInterface}; +use crate::graphics::{Compositor, compositor}; use crate::runtime::Debug; +use crate::runtime::user_interface::{self, UserInterface}; use crate::runtime::{self, Action, Task}; use crate::{Clipboard, Error, Proxy, Settings}; @@ -406,7 +406,9 @@ where .with_canvas(self.canvas.take()) }; - log::info!("Window attributes for id `{id:#?}`: {window_attributes:#?}"); + log::info!( + "Window attributes for id `{id:#?}`: {window_attributes:#?}" + ); // On macOS, the `position` in `WindowAttributes` represents the "inner" // position of the window; while on other platforms it's the "outer" position. diff --git a/winit/src/program/state.rs b/winit/src/program/state.rs index e883d04a..911e84fe 100644 --- a/winit/src/program/state.rs +++ b/winit/src/program/state.rs @@ -1,6 +1,6 @@ use crate::conversion; -use crate::core::{mouse, theme, window}; use crate::core::{Color, Size}; +use crate::core::{mouse, theme, window}; use crate::graphics::Viewport; use crate::program::Program; diff --git a/winit/src/proxy.rs b/winit/src/proxy.rs index d8ad8b3f..d8d3f4a2 100644 --- a/winit/src/proxy.rs +++ b/winit/src/proxy.rs @@ -1,8 +1,8 @@ use crate::futures::futures::{ + Future, Sink, StreamExt, channel::mpsc, select, task::{Context, Poll}, - Future, Sink, StreamExt, }; use crate::runtime::Action; use std::pin::Pin; |