Skip to content

Commit

Permalink
Ignoring some Broken Clippy calls and Fixing some actual clippy issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
genusistimelord committed Jun 27, 2024
1 parent 9ef6717 commit 4dfb6a2
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 89 deletions.
5 changes: 4 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@
clippy::missing_const_for_fn,
clippy::too_many_lines,
clippy::cast_precision_loss,
clippy::missing_docs_in_private_items
clippy::missing_docs_in_private_items,
clippy::unit_arg,
clippy::trivially_copy_pass_by_ref,
clippy::let_unit_value
)]

pub mod widgets;
Expand Down
38 changes: 6 additions & 32 deletions src/widgets/overlay/color_picker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,6 @@ where
event: &Event,
layout: Layout<'_>,
cursor: Cursor,
_shell: &mut Shell<Message>,
_renderer: &Renderer,
_clipboard: &mut dyn Clipboard,
) -> event::Status {
let mut hsv_color_children = layout.children();

Expand Down Expand Up @@ -258,9 +255,6 @@ where
event: &Event,
layout: Layout<'_>,
cursor: Cursor,
_shell: &mut Shell<Message>,
_renderer: &Renderer,
_clipboard: &mut dyn Clipboard,
) -> event::Status {
let mut rgba_color_children = layout.children();
let mut color_changed = false;
Expand Down Expand Up @@ -424,15 +418,7 @@ where
}

/// The even handling for the keyboard input.
fn on_event_keyboard(
&mut self,
event: &Event,
_layout: Layout<'_>,
_cursor: Cursor,
_shell: &mut Shell<Message>,
_renderer: &Renderer,
_clipboard: &mut dyn Clipboard,
) -> event::Status {
fn on_event_keyboard(&mut self, event: &Event) -> event::Status {
if self.state.focus == Focus::None {
return event::Status::Ignored;
}
Expand Down Expand Up @@ -610,10 +596,10 @@ where
.bounds();

// ----------- Block 1 ----------------------
let block1_node = block1_layout(self, renderer, block1_bounds, self.position);
let block1_node = block1_layout(self, renderer, block1_bounds);

// ----------- Block 2 ----------------------
let block2_node = block2_layout(self, renderer, block2_bounds, self.position);
let block2_node = block2_layout(self, renderer, block2_bounds);

let (width, height) = if bounds.width > bounds.height {
(
Expand Down Expand Up @@ -643,9 +629,7 @@ where
clipboard: &mut dyn Clipboard,
shell: &mut Shell<Message>,
) -> event::Status {
if event::Status::Captured
== self.on_event_keyboard(&event, layout, cursor, shell, renderer, clipboard)
{
if event::Status::Captured == self.on_event_keyboard(&event) {
self.state.sat_value_canvas_cache.clear();
self.state.hue_canvas_cache.clear();
return event::Status::Captured;
Expand All @@ -659,8 +643,7 @@ where
let block1_layout = children
.next()
.expect("widgets: Layout should have a 1. block layout");
let hsv_color_status =
self.on_event_hsv_color(&event, block1_layout, cursor, shell, renderer, clipboard);
let hsv_color_status = self.on_event_hsv_color(&event, block1_layout, cursor);
// ----------- Block 1 end ------------------

// ----------- Block 2 ----------------------
Expand All @@ -673,14 +656,7 @@ where
let rgba_color_layout = block2_children
.next()
.expect("widgets: Layout should have a RGBA color layout");
let rgba_color_status = self.on_event_rgba_color(
&event,
rgba_color_layout,
cursor,
shell,
renderer,
clipboard,
);
let rgba_color_status = self.on_event_rgba_color(&event, rgba_color_layout, cursor);

let mut fake_messages: Vec<Message> = Vec::new();

Expand Down Expand Up @@ -923,7 +899,6 @@ fn block1_layout<'a, Message, Theme>(
color_picker: &mut ColorPickerOverlay<'_, '_, Message, Theme>,
renderer: &Renderer,
bounds: Rectangle,
_position: Point,
) -> Node
where
Message: 'static + Clone,
Expand Down Expand Up @@ -958,7 +933,6 @@ fn block2_layout<'a, Message, Theme>(
color_picker: &mut ColorPickerOverlay<'_, '_, Message, Theme>,
renderer: &Renderer,
bounds: Rectangle,
_position: Point,
) -> Node
where
Message: 'static + Clone,
Expand Down
32 changes: 4 additions & 28 deletions src/widgets/overlay/date_picker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,6 @@ where
event: &Event,
layout: Layout<'_>,
cursor: Cursor,
_messages: &mut Shell<Message>,
_renderer: &Renderer,
_clipboard: &mut dyn Clipboard,
) -> event::Status {
let mut children = layout.children();

Expand Down Expand Up @@ -237,9 +234,6 @@ where
event: &Event,
layout: Layout<'_>,
cursor: Cursor,
_messages: &mut Shell<Message>,
_renderer: &Renderer,
_clipboard: &mut dyn Clipboard,
) -> event::Status {
let mut children = layout.children();

Expand Down Expand Up @@ -296,15 +290,7 @@ where
}

/// The event handling for the keyboard input.
fn on_event_keyboard(
&mut self,
event: &Event,
_layout: Layout<'_>,
_cursor: Cursor,
_messages: &mut Shell<Message>,
_renderer: &Renderer,
_clipboard: &mut dyn Clipboard,
) -> event::Status {
fn on_event_keyboard(&mut self, event: &Event) -> event::Status {
if self.state.focus == Focus::None {
return event::Status::Ignored;
}
Expand Down Expand Up @@ -562,9 +548,7 @@ where
clipboard: &mut dyn Clipboard,
shell: &mut Shell<Message>,
) -> event::Status {
if event::Status::Captured
== self.on_event_keyboard(&event, layout, cursor, shell, renderer, clipboard)
{
if event::Status::Captured == self.on_event_keyboard(&event) {
return event::Status::Captured;
}

Expand All @@ -579,14 +563,7 @@ where
let month_year_layout = date_children
.next()
.expect("widgets: Layout should have a month/year layout");
let month_year_status = self.on_event_month_year(
&event,
month_year_layout,
cursor,
shell,
renderer,
clipboard,
);
let month_year_status = self.on_event_month_year(&event, month_year_layout, cursor);

// ----------- Days ----------------------
let days_layout = date_children
Expand All @@ -595,8 +572,7 @@ where
.children()
.next()
.expect("widgets: Layout should have a days table layout");
let days_status =
self.on_event_days(&event, days_layout, cursor, shell, renderer, clipboard);
let days_status = self.on_event_days(&event, days_layout, cursor);

// ----------- Buttons ------------------------
let cancel_button_layout = children
Expand Down
33 changes: 5 additions & 28 deletions src/widgets/overlay/time_picker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,6 @@ where
event: &Event,
layout: Layout<'_>,
cursor: Cursor,
_shell: &mut Shell<Message>,
_renderer: &Renderer,
_clipboard: &mut dyn Clipboard,
) -> event::Status {
if cursor.is_over(layout.bounds()) {
self.state.clock_cache_needs_clearance = true;
Expand Down Expand Up @@ -321,9 +318,6 @@ where
event: &Event,
layout: Layout<'_>,
cursor: Cursor,
_shell: &mut Shell<Message>,
_renderer: &Renderer,
_clipboard: &mut dyn Clipboard,
) -> event::Status {
let mut digital_clock_children = layout.children();

Expand Down Expand Up @@ -451,15 +445,7 @@ where
}

/// The event handling for the keyboard input.
fn on_event_keyboard(
&mut self,
event: &Event,
_layout: Layout<'_>,
_cursor: Cursor,
_shell: &mut Shell<Message>,
_renderer: &Renderer,
_clipboard: &mut dyn Clipboard,
) -> event::Status {
fn on_event_keyboard(&mut self, event: &Event) -> event::Status {
if self.state.focus == Focus::None {
return event::Status::Ignored;
}
Expand Down Expand Up @@ -629,9 +615,7 @@ where
clipboard: &mut dyn Clipboard,
shell: &mut Shell<Message>,
) -> event::Status {
if event::Status::Captured
== self.on_event_keyboard(&event, layout, cursor, shell, renderer, clipboard)
{
if event::Status::Captured == self.on_event_keyboard(&event) {
return event::Status::Captured;
}

Expand All @@ -641,8 +625,7 @@ where
let clock_layout = children
.next()
.expect("widgets: Layout should have a clock canvas layout");
let clock_status =
self.on_event_clock(&event, clock_layout, cursor, shell, renderer, clipboard);
let clock_status = self.on_event_clock(&event, clock_layout, cursor);

// ----------- Digital clock ------------------
let digital_clock_layout = children
Expand All @@ -651,14 +634,8 @@ where
.children()
.next()
.expect("widgets: Layout should have a digital clock layout");
let digital_clock_status = self.on_event_digital_clock(
&event,
digital_clock_layout,
cursor,
shell,
renderer,
clipboard,
);
let digital_clock_status =
self.on_event_digital_clock(&event, digital_clock_layout, cursor);

// ----------- Buttons ------------------------
let cancel_button_layout = children
Expand Down

0 comments on commit 4dfb6a2

Please sign in to comment.