Skip to content

Commit dca40f0

Browse files
committed
clippy
1 parent 734faa4 commit dca40f0

7 files changed

Lines changed: 13 additions & 17 deletions

File tree

src/app/tile.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ impl Tile {
296296
} else if modifiers.command() {
297297
s.parse::<usize>()
298298
.ok()
299-
.filter(|&n| n >= 1 && n <= 9)
299+
.filter(|&n| (1..=9).contains(&n))
300300
.map(|n| Message::OpenResult((n - 1) as u32))
301301
} else if s == "p" && modifiers.control() {
302302
Some(Message::ChangeFocus(ArrowKey::Up, 1))

src/app/tile/elm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pub fn new(hotkeys: Hotkeys, config: &Config) -> (Tile, Task<Message>) {
4141

4242
let events = Event::get_events(config.event_duration);
4343

44-
let pos = config.window_location.clone();
44+
let pos = config.window_location;
4545

4646
let open = open.discard().chain(window::run(id, move |handle| {
4747
platform::window_config(

src/app/tile/update.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -513,12 +513,12 @@ pub fn handle_update(tile: &mut Tile, message: Message) -> Task<Message> {
513513
])
514514
}
515515
Message::RunFunction(command) => {
516-
if let Function::TileWindow(pos) = &command {
517-
if let Some(pid) = tile.frontmost.as_ref().map(|a| a.processIdentifier()) {
518-
let ok = crate::platform::macos::window::tile_focused_window(pid, pos);
519-
if !ok && tile.config.haptic_feedback {
520-
perform_haptic(HapticPattern::Alignment);
521-
}
516+
if let Function::TileWindow(pos) = &command
517+
&& let Some(pid) = tile.frontmost.as_ref().map(|a| a.processIdentifier())
518+
{
519+
let ok = crate::platform::macos::window::tile_focused_window(pid, pos);
520+
if !ok && tile.config.haptic_feedback {
521+
perform_haptic(HapticPattern::Alignment);
522522
}
523523
}
524524
command.execute(&tile.config);

src/config.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,18 +169,14 @@ impl std::fmt::Display for MainPage {
169169
/// The mode for the theme (dark, light, or follow system)
170170
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq, Copy)]
171171
#[serde(rename_all = "lowercase")]
172+
#[derive(Default)]
172173
pub enum ThemeMode {
174+
#[default]
173175
Dark,
174176
Light,
175177
System,
176178
}
177179

178-
impl Default for ThemeMode {
179-
fn default() -> Self {
180-
ThemeMode::Dark
181-
}
182-
}
183-
184180
impl ThemeMode {
185181
/// Return preset text and background colors for this mode.
186182
pub fn presets(

src/platform/macos/launching.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ extern "C-unwind" fn keyboard_event_callback(
121121
_ => return unsafe { event.as_mut() },
122122
};
123123

124-
if !data.targets.iter().any(|t| *t == shortcut) {
124+
if !data.targets.contains(&shortcut) {
125125
return unsafe { event.as_mut() };
126126
}
127127

src/platform/macos/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ pub fn screen_with_mouse() -> Retained<NSScreen> {
7575
}
7676

7777
/// This carries out the window configuration for the macos window (only things that are macos specific)
78-
pub(super) fn macos_window_config(handle: &WindowHandle, position: Position) {
78+
pub(super) fn macos_window_config(handle: &WindowHandle, _position: Position) {
7979
use iced::wgpu::rwh::RawWindowHandle;
8080
use objc2::rc::Retained;
8181
use objc2_app_kit::NSView;

src/styles.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
use crate::config::Theme as ConfigTheme;
33
use iced::Shadow;
44
use iced::border::Radius;
5-
use iced::overlay::menu::{self, Menu};
5+
use iced::overlay::menu::{self};
66
use iced::widget::toggler::Status;
77
use iced::widget::{button, container, pick_list, radio, scrollable, slider, toggler};
88
use iced::{Background, Border, Color, widget::text_input};

0 commit comments

Comments
 (0)