Skip to content

Commit ac9d91b

Browse files
committed
Auto-format the existing code with new rules
1 parent 6d9620a commit ac9d91b

File tree

35 files changed

+111
-109
lines changed

35 files changed

+111
-109
lines changed

input-capture/src/dummy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::f64::consts::PI;
22
use std::pin::Pin;
3-
use std::task::{ready, Context, Poll};
3+
use std::task::{Context, Poll, ready};
44
use std::time::Duration;
55

66
use async_trait::async_trait;

input-capture/src/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ pub enum InputCaptureError {
1212
use std::io;
1313
#[cfg(all(unix, feature = "layer_shell", not(target_os = "macos")))]
1414
use wayland_client::{
15+
ConnectError, DispatchError,
1516
backend::WaylandError,
1617
globals::{BindError, GlobalError},
17-
ConnectError, DispatchError,
1818
};
1919

2020
#[cfg(all(unix, feature = "libei", not(target_os = "macos")))]

input-capture/src/layer_shell.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::{
77
io::{self, ErrorKind},
88
os::fd::{AsFd, RawFd},
99
pin::Pin,
10-
task::{ready, Context, Poll},
10+
task::{Context, Poll, ready},
1111
};
1212
use tokio::io::unix::AsyncFd;
1313

@@ -45,9 +45,10 @@ use wayland_protocols_wlr::layer_shell::v1::client::{
4545
};
4646

4747
use wayland_client::{
48+
Connection, Dispatch, DispatchError, EventQueue, QueueHandle, WEnum,
4849
backend::{ReadEventsGuard, WaylandError},
4950
delegate_noop,
50-
globals::{registry_queue_init, Global, GlobalList, GlobalListContents},
51+
globals::{Global, GlobalList, GlobalListContents, registry_queue_init},
5152
protocol::{
5253
wl_buffer, wl_compositor,
5354
wl_keyboard::{self, WlKeyboard},
@@ -58,16 +59,15 @@ use wayland_client::{
5859
wl_seat, wl_shm, wl_shm_pool,
5960
wl_surface::WlSurface,
6061
},
61-
Connection, Dispatch, DispatchError, EventQueue, QueueHandle, WEnum,
6262
};
6363

6464
use input_event::{Event, KeyboardEvent, PointerEvent};
6565

6666
use crate::{CaptureError, CaptureEvent};
6767

6868
use super::{
69-
error::{LayerShellCaptureCreationError, WaylandBindError},
7069
Capture, Position,
70+
error::{LayerShellCaptureCreationError, WaylandBindError},
7171
};
7272

7373
struct Globals {

input-capture/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ use std::{
22
collections::{HashMap, HashSet, VecDeque},
33
fmt::Display,
44
mem::swap,
5-
task::{ready, Poll},
5+
task::{Poll, ready},
66
};
77

88
use async_trait::async_trait;
99
use futures::StreamExt;
1010
use futures_core::Stream;
1111

12-
use input_event::{scancode, Event, KeyboardEvent};
12+
use input_event::{Event, KeyboardEvent, scancode};
1313

1414
pub use error::{CaptureCreationError, CaptureError, InputCaptureError};
1515

input-capture/src/libei.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use ashpd::{
22
desktop::{
3+
Session,
34
input_capture::{
45
Activated, ActivatedBarrier, Barrier, BarrierID, Capabilities, InputCapture, Region,
56
Zones,
67
},
7-
Session,
88
},
99
enumflags2::BitFlags,
1010
};
@@ -28,8 +28,8 @@ use std::{
2828
};
2929
use tokio::{
3030
sync::{
31-
mpsc::{self, Receiver, Sender},
3231
Notify,
32+
mpsc::{self, Receiver, Sender},
3333
},
3434
task::JoinHandle,
3535
};
@@ -42,8 +42,8 @@ use input_event::Event;
4242
use crate::CaptureEvent;
4343

4444
use super::{
45-
error::{CaptureError, LibeiCaptureCreationError},
4645
Capture as LanMouseInputCapture, Position,
46+
error::{CaptureError, LibeiCaptureCreationError},
4747
};
4848

4949
/* there is a bug in xdg-remote-desktop-portal-gnome / mutter that

input-capture/src/macos.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
use super::{error::MacosCaptureCreationError, Capture, CaptureError, CaptureEvent, Position};
1+
use super::{Capture, CaptureError, CaptureEvent, Position, error::MacosCaptureCreationError};
22
use async_trait::async_trait;
33
use bitflags::bitflags;
44
use core_foundation::{
5-
base::{kCFAllocatorDefault, CFRelease},
5+
base::{CFRelease, kCFAllocatorDefault},
66
date::CFTimeInterval,
7-
number::{kCFBooleanTrue, CFBooleanRef},
8-
runloop::{kCFRunLoopCommonModes, CFRunLoop, CFRunLoopSource},
9-
string::{kCFStringEncodingUTF8, CFStringCreateWithCString, CFStringRef},
7+
number::{CFBooleanRef, kCFBooleanTrue},
8+
runloop::{CFRunLoop, CFRunLoopSource, kCFRunLoopCommonModes},
9+
string::{CFStringCreateWithCString, CFStringRef, kCFStringEncodingUTF8},
1010
};
1111
use core_graphics::{
12-
base::{kCGErrorSuccess, CGError},
12+
base::{CGError, kCGErrorSuccess},
1313
display::{CGDisplay, CGPoint},
1414
event::{
1515
CGEvent, CGEventFlags, CGEventTap, CGEventTapLocation, CGEventTapOptions,
@@ -18,21 +18,22 @@ use core_graphics::{
1818
event_source::{CGEventSource, CGEventSourceStateID},
1919
};
2020
use futures_core::Stream;
21-
use input_event::{Event, KeyboardEvent, PointerEvent, BTN_LEFT, BTN_MIDDLE, BTN_RIGHT};
21+
use input_event::{BTN_LEFT, BTN_MIDDLE, BTN_RIGHT, Event, KeyboardEvent, PointerEvent};
2222
use keycode::{KeyMap, KeyMapping};
2323
use libc::c_void;
2424
use once_cell::unsync::Lazy;
2525
use std::{
2626
collections::HashSet,
27-
ffi::{c_char, CString},
27+
ffi::{CString, c_char},
2828
pin::Pin,
2929
sync::Arc,
30-
task::{ready, Context, Poll},
30+
task::{Context, Poll, ready},
3131
thread::{self},
3232
};
3333
use tokio::sync::{
34+
Mutex,
3435
mpsc::{self, Receiver, Sender},
35-
oneshot, Mutex,
36+
oneshot,
3637
};
3738

3839
#[derive(Debug, Default)]

input-capture/src/windows.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use futures::Stream;
55
use std::pin::Pin;
66

77
use std::task::ready;
8-
use tokio::sync::mpsc::{channel, Receiver};
8+
use tokio::sync::mpsc::{Receiver, channel};
99

1010
use super::{Capture, CaptureError, CaptureEvent, Position};
1111

input-capture/src/windows/event_thread.rs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,33 +6,32 @@ use std::default::Default;
66
use std::sync::atomic::{AtomicBool, AtomicI32, Ordering};
77
use std::sync::{Arc, Condvar, Mutex};
88
use std::thread;
9-
use tokio::sync::mpsc::error::TrySendError;
109
use tokio::sync::mpsc::Sender;
11-
use windows::core::{w, PCWSTR};
10+
use tokio::sync::mpsc::error::TrySendError;
1211
use windows::Win32::Foundation::{FALSE, HWND, LPARAM, LRESULT, RECT, WPARAM};
1312
use windows::Win32::Graphics::Gdi::{
14-
EnumDisplayDevicesW, EnumDisplaySettingsW, DEVMODEW, DISPLAY_DEVICEW,
15-
DISPLAY_DEVICE_ATTACHED_TO_DESKTOP, ENUM_CURRENT_SETTINGS,
13+
DEVMODEW, DISPLAY_DEVICE_ATTACHED_TO_DESKTOP, DISPLAY_DEVICEW, ENUM_CURRENT_SETTINGS,
14+
EnumDisplayDevicesW, EnumDisplaySettingsW,
1615
};
1716
use windows::Win32::System::LibraryLoader::GetModuleHandleW;
1817
use windows::Win32::System::Threading::GetCurrentThreadId;
18+
use windows::core::{PCWSTR, w};
1919

2020
use windows::Win32::UI::WindowsAndMessaging::{
21-
CallNextHookEx, CreateWindowExW, DispatchMessageW, GetMessageW, PostThreadMessageW,
22-
RegisterClassW, SetWindowsHookExW, TranslateMessage, EDD_GET_DEVICE_INTERFACE_NAME, HOOKPROC,
23-
KBDLLHOOKSTRUCT, LLKHF_EXTENDED, MSG, MSLLHOOKSTRUCT, WH_KEYBOARD_LL, WH_MOUSE_LL,
24-
WINDOW_STYLE, WM_DISPLAYCHANGE, WM_KEYDOWN, WM_KEYUP, WM_LBUTTONDOWN, WM_LBUTTONUP,
25-
WM_MBUTTONDOWN, WM_MBUTTONUP, WM_MOUSEHWHEEL, WM_MOUSEMOVE, WM_MOUSEWHEEL, WM_RBUTTONDOWN,
26-
WM_RBUTTONUP, WM_SYSKEYDOWN, WM_SYSKEYUP, WM_USER, WM_XBUTTONDOWN, WM_XBUTTONUP, WNDCLASSW,
27-
WNDPROC,
21+
CallNextHookEx, CreateWindowExW, DispatchMessageW, EDD_GET_DEVICE_INTERFACE_NAME, GetMessageW,
22+
HOOKPROC, KBDLLHOOKSTRUCT, LLKHF_EXTENDED, MSG, MSLLHOOKSTRUCT, PostThreadMessageW,
23+
RegisterClassW, SetWindowsHookExW, TranslateMessage, WH_KEYBOARD_LL, WH_MOUSE_LL, WINDOW_STYLE,
24+
WM_DISPLAYCHANGE, WM_KEYDOWN, WM_KEYUP, WM_LBUTTONDOWN, WM_LBUTTONUP, WM_MBUTTONDOWN,
25+
WM_MBUTTONUP, WM_MOUSEHWHEEL, WM_MOUSEMOVE, WM_MOUSEWHEEL, WM_RBUTTONDOWN, WM_RBUTTONUP,
26+
WM_SYSKEYDOWN, WM_SYSKEYUP, WM_USER, WM_XBUTTONDOWN, WM_XBUTTONUP, WNDCLASSW, WNDPROC,
2827
};
2928

3029
use input_event::{
30+
BTN_BACK, BTN_FORWARD, BTN_LEFT, BTN_MIDDLE, BTN_RIGHT, Event, KeyboardEvent, PointerEvent,
3131
scancode::{self, Linux},
32-
Event, KeyboardEvent, PointerEvent, BTN_BACK, BTN_FORWARD, BTN_LEFT, BTN_MIDDLE, BTN_RIGHT,
3332
};
3433

35-
use super::{display_util, CaptureEvent, Position};
34+
use super::{CaptureEvent, Position, display_util};
3635

3736
pub(crate) struct EventThread {
3837
request_buffer: Arc<Mutex<Vec<ClientUpdate>>>,

input-capture/src/x11.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::task::Poll;
33
use async_trait::async_trait;
44
use futures_core::Stream;
55

6-
use super::{error::X11InputCaptureCreationError, Capture, CaptureError, CaptureEvent, Position};
6+
use super::{Capture, CaptureError, CaptureEvent, Position, error::X11InputCaptureCreationError};
77

88
pub struct X11InputCapture {}
99

input-emulation/src/error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ pub enum InputEmulationError {
1111
any(feature = "remote_desktop_portal", feature = "libei"),
1212
not(target_os = "macos")
1313
))]
14-
use ashpd::{desktop::ResponseError, Error::Response};
14+
use ashpd::{Error::Response, desktop::ResponseError};
1515
use std::io;
1616
use thiserror::Error;
1717

1818
#[cfg(all(unix, feature = "wlroots", not(target_os = "macos")))]
1919
use wayland_client::{
20+
ConnectError, DispatchError,
2021
backend::WaylandError,
2122
globals::{BindError, GlobalError},
22-
ConnectError, DispatchError,
2323
};
2424

2525
#[derive(Debug, Error)]

0 commit comments

Comments
 (0)