From ee1d54a12bda4115fdf39c6efc17e48d5aad396d Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Wed, 24 Apr 2024 13:00:40 -0700 Subject: [PATCH] Format imports --- rustfmt.toml | 1 + src/backend/mock.rs | 2 +- src/backend/wayland/buffer.rs | 10 +++++----- src/backend/wayland/mod.rs | 10 ++++++---- src/backend/wayland/screencopy.rs | 23 +++++++++++++---------- src/main.rs | 4 ++-- src/widgets/image_bg.rs | 22 ++++++++++++---------- src/widgets/visibility_wrapper.rs | 4 ++-- 8 files changed, 42 insertions(+), 34 deletions(-) create mode 100644 rustfmt.toml diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 0000000..c3c8c37 --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1 @@ +imports_granularity = "Crate" diff --git a/src/backend/mock.rs b/src/backend/mock.rs index 767f1c2..82ef1e1 100644 --- a/src/backend/mock.rs +++ b/src/backend/mock.rs @@ -187,7 +187,7 @@ impl AppData { } } -fn start(conn: Connection) -> mpsc::Receiver { +fn start(_conn: Connection) -> mpsc::Receiver { let (sender, receiver) = mpsc::channel(20); thread::spawn(move || { let mut event_loop = calloop::EventLoop::try_new().unwrap(); diff --git a/src/backend/wayland/buffer.rs b/src/backend/wayland/buffer.rs index 849b090..12cd105 100644 --- a/src/backend/wayland/buffer.rs +++ b/src/backend/wayland/buffer.rs @@ -5,14 +5,14 @@ use cctk::{ Connection, Dispatch, QueueHandle, }, }; -use cosmic::cctk; -use cosmic::iced_sctk::subsurface_widget::{BufferSource, Dmabuf, Plane, Shmbuf}; -use rustix::{io::Errno, shm::ShmOFlags}; +use cosmic::{ + cctk, + iced_sctk::subsurface_widget::{BufferSource, Dmabuf, Plane, Shmbuf}, +}; use std::{ - os::fd::{AsFd, OwnedFd}, + os::fd::AsFd, path::{Path, PathBuf}, sync::Arc, - time::{SystemTime, UNIX_EPOCH}, }; use wayland_protocols::wp::linux_dmabuf::zv1::client::zwp_linux_buffer_params_v1; diff --git a/src/backend/wayland/mod.rs b/src/backend/wayland/mod.rs index 1bf3c2f..4ecf2b0 100644 --- a/src/backend/wayland/mod.rs +++ b/src/backend/wayland/mod.rs @@ -18,10 +18,12 @@ use cctk::{ }, workspace::WorkspaceState, }; -use cosmic::cctk; -use cosmic::iced::{ - self, - futures::{executor::block_on, FutureExt, SinkExt}, +use cosmic::{ + cctk, + iced::{ + self, + futures::{executor::block_on, FutureExt, SinkExt}, + }, }; use futures_channel::mpsc; use std::{cell::RefCell, collections::HashMap, fs, path::PathBuf, sync::Arc, thread}; diff --git a/src/backend/wayland/screencopy.rs b/src/backend/wayland/screencopy.rs index 6f2079a..21a3165 100644 --- a/src/backend/wayland/screencopy.rs +++ b/src/backend/wayland/screencopy.rs @@ -1,15 +1,18 @@ -use cosmic::cctk::{ - self, - cosmic_protocols::screencopy::v2::client::{ - zcosmic_screencopy_frame_v2, zcosmic_screencopy_manager_v2, zcosmic_screencopy_session_v2, +use cosmic::{ + cctk::{ + self, + cosmic_protocols::screencopy::v2::client::{ + zcosmic_screencopy_frame_v2, zcosmic_screencopy_manager_v2, + zcosmic_screencopy_session_v2, + }, + screencopy::{ + capture, Formats, Frame, ScreencopyFrameData, ScreencopyFrameDataExt, + ScreencopyHandler, ScreencopySessionData, ScreencopySessionDataExt, ScreencopyState, + }, + wayland_client::{Connection, Proxy, QueueHandle, WEnum}, }, - screencopy::{ - capture, Formats, Frame, ScreencopyFrameData, ScreencopyFrameDataExt, ScreencopyHandler, - ScreencopySessionData, ScreencopySessionDataExt, ScreencopyState, - }, - wayland_client::{Connection, Proxy, QueueHandle, WEnum}, + iced_sctk::subsurface_widget::{SubsurfaceBuffer, SubsurfaceBufferRelease}, }; -use cosmic::iced_sctk::subsurface_widget::{SubsurfaceBuffer, SubsurfaceBufferRelease}; use std::{ array, sync::{Arc, Weak}, diff --git a/src/main.rs b/src/main.rs index 1b254b2..5524d88 100644 --- a/src/main.rs +++ b/src/main.rs @@ -496,8 +496,8 @@ impl Application for App { } Msg::StartDrag(size, drag_surface) => { let (output, mime_type) = match &drag_surface { - DragSurface::Workspace { handle, output } => (output, &*WORKSPACE_MIME), - DragSurface::Toplevel { handle, output } => (output, &*TOPLEVEL_MIME), + DragSurface::Workspace { handle: _, output } => (output, &*WORKSPACE_MIME), + DragSurface::Toplevel { handle: _, output } => (output, &*TOPLEVEL_MIME), }; let id = SurfaceId::unique(); if let Some((parent_id, _)) = self diff --git a/src/widgets/image_bg.rs b/src/widgets/image_bg.rs index 1b4cd84..9804cf5 100644 --- a/src/widgets/image_bg.rs +++ b/src/widgets/image_bg.rs @@ -1,17 +1,19 @@ // Renders image behind widget, and otherwise passes through all behavior -use cosmic::iced::{ - advanced::{ - layout::{self}, - mouse, overlay, renderer, - widget::{tree, Operation, OperationOutputWrapper, Tree}, - Clipboard, Layout, Shell, Widget, +use cosmic::{ + iced::{ + advanced::{ + layout::{self}, + mouse, overlay, renderer, + widget::{tree, Operation, OperationOutputWrapper, Tree}, + Clipboard, Layout, Shell, Widget, + }, + event::{self, Event}, + widget::image::{FilterMethod, Handle}, + ContentFit, Length, Rectangle, Size, Vector, }, - event::{self, Event}, - widget::image::{FilterMethod, Handle}, - ContentFit, Length, Rectangle, Size, Vector, + iced_core::Renderer, }; -use cosmic::iced_core::Renderer; use std::marker::PhantomData; diff --git a/src/widgets/visibility_wrapper.rs b/src/widgets/visibility_wrapper.rs index fb820cd..db850da 100644 --- a/src/widgets/visibility_wrapper.rs +++ b/src/widgets/visibility_wrapper.rs @@ -3,8 +3,8 @@ use cosmic::iced::{ advanced::{ - layout, mouse, overlay, renderer, - widget::{tree, Id, Operation, OperationOutputWrapper, Tree}, + layout, mouse, renderer, + widget::{Operation, OperationOutputWrapper, Tree}, Clipboard, Layout, Shell, Widget, }, event::{self, Event},