From 17bc373990948a5c445f776fab11d3e62a126c20 Mon Sep 17 00:00:00 2001 From: Ashley Wulber Date: Mon, 4 Dec 2023 10:14:50 -0500 Subject: [PATCH] clippy fixes --- src/keyboard_nav.rs | 2 +- src/widget/dropdown/menu/mod.rs | 2 +- src/widget/dropdown/widget.rs | 8 ++++---- src/widget/flex_row/layout.rs | 2 +- src/widget/menu/menu_inner.rs | 2 +- src/widget/segmented_button/widget.rs | 2 +- src/widget/text_input/input.rs | 14 +++++++------- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/keyboard_nav.rs b/src/keyboard_nav.rs index 1f3e7ff..32bea5b 100644 --- a/src/keyboard_nav.rs +++ b/src/keyboard_nav.rs @@ -6,7 +6,7 @@ use iced::{ event, keyboard::{self, KeyCode}, - mouse, subscription, Command, Event, Subscription, + mouse, Command, Event, Subscription, }; use iced_core::{ widget::{operation, Id, Operation}, diff --git a/src/widget/dropdown/menu/mod.rs b/src/widget/dropdown/menu/mod.rs index 589ff29..5c5f490 100644 --- a/src/widget/dropdown/menu/mod.rs +++ b/src/widget/dropdown/menu/mod.rs @@ -209,7 +209,7 @@ impl<'a, Message> iced_core::Overlay for Overlay<'a, M ) .width(self.width); - let mut node = self.container.layout(&mut self.state, renderer, &limits); + let mut node = self.container.layout(self.state, renderer, &limits); node.move_to(if space_below > space_above { position + Vector::new(0.0, self.target_height) diff --git a/src/widget/dropdown/widget.rs b/src/widget/dropdown/widget.rs index 632eaf5..3730609 100644 --- a/src/widget/dropdown/widget.rs +++ b/src/widget/dropdown/widget.rs @@ -413,13 +413,13 @@ pub fn mouse_interaction(layout: Layout<'_>, cursor: mouse::Cursor) -> mouse::In #[allow(clippy::too_many_arguments)] pub fn overlay<'a, S: AsRef, Message: 'a>( layout: Layout<'_>, - renderer: &crate::Renderer, + _renderer: &crate::Renderer, state: &'a mut State, gap: f32, padding: Padding, text_size: f32, - text_line_height: text::LineHeight, - font: Option, + _text_line_height: text::LineHeight, + _font: Option, selections: &'a [S], selected_option: Option, on_selected: &'a dyn Fn(usize) -> Message, @@ -440,7 +440,7 @@ pub fn overlay<'a, S: AsRef, Message: 'a>( None, ) .width({ - let measure = |label: &str, selection_paragraph: &mut crate::Paragraph| -> f32 { + let measure = |_label: &str, selection_paragraph: &mut crate::Paragraph| -> f32 { selection_paragraph.min_width().round() }; diff --git a/src/widget/flex_row/layout.rs b/src/widget/flex_row/layout.rs index ba4de64..bcd9e4a 100644 --- a/src/widget/flex_row/layout.rs +++ b/src/widget/flex_row/layout.rs @@ -28,7 +28,7 @@ pub fn resolve( let mut row_buffer = Vec::::with_capacity(8); - for (child, tree) in items.iter().zip(tree.into_iter()) { + for (child, tree) in items.iter().zip(tree.iter_mut()) { // Calculate the dimensions of the item. let child_node = child.as_widget().layout(tree, renderer, &limits); let size = child_node.size(); diff --git a/src/widget/menu/menu_inner.rs b/src/widget/menu/menu_inner.rs index 3608cf3..4c748f3 100644 --- a/src/widget/menu/menu_inner.rs +++ b/src/widget/menu/menu_inner.rs @@ -478,7 +478,7 @@ where let active_tree = &mut tree_children[active_root]; state.menu_states.iter().enumerate().fold( (root, Vec::new()), - |(menu_root, mut nodes), (i, ms)| { + |(menu_root, mut nodes), (_i, ms)| { let slice = ms.slice(bounds, overlay_offset, self.item_height); let start_index = slice.start_index; let end_index = slice.end_index; diff --git a/src/widget/segmented_button/widget.rs b/src/widget/segmented_button/widget.rs index ae4fd78..d2847c4 100644 --- a/src/widget/segmented_button/widget.rs +++ b/src/widget/segmented_button/widget.rs @@ -226,7 +226,7 @@ where &self, state: &mut LocalState, renderer: &Renderer, - bounds: Size, + _bounds: Size, ) -> (f32, f32) { let mut width = 0.0f32; let mut height = 0.0f32; diff --git a/src/widget/text_input/input.rs b/src/widget/text_input/input.rs index 993dd98..3146818 100644 --- a/src/widget/text_input/input.rs +++ b/src/widget/text_input/input.rs @@ -196,7 +196,6 @@ pub struct TextInput<'a, Message> { leading_icon: Option>, trailing_icon: Option>, style: <::Theme as StyleSheet>::Style, - // (text_input::State, mime_type, dnd_action) -> Message on_create_dnd_source: Option Message + 'a>>, on_dnd_command_produced: Option Message + 'a>>, surface_ids: Option<(window::Id, window::Id)>, @@ -1074,10 +1073,10 @@ pub fn update<'a, Message>( on_paste: Option<&dyn Fn(String) -> Message>, on_submit: &Option, state: impl FnOnce() -> &'a mut State, - on_start_dnd_source: Option<&dyn Fn(State) -> Message>, - _dnd_icon: bool, - on_dnd_command_produced: Option<&dyn Fn(DnDCommand) -> Message>, - surface_ids: Option<(window::Id, window::Id)>, + #[allow(unused_variables)] on_start_dnd_source: Option<&dyn Fn(State) -> Message>, + #[allow(unused_variables)] dnd_icon: bool, + #[allow(unused_variables)] on_dnd_command_produced: Option<&dyn Fn(DnDCommand) -> Message>, + #[allow(unused_variables)] surface_ids: Option<(window::Id, window::Id)>, line_height: text::LineHeight, layout: Layout<'_>, ) -> event::Status @@ -1203,7 +1202,7 @@ where find_cursor_position( text_layout.bounds(), &value, - &state, + state, target, ) } else { @@ -2156,6 +2155,7 @@ pub struct State { pub label: crate::Paragraph, is_focused: Option, dragging_state: Option, + #[cfg(feature = "wayland")] dnd_offer: DndOfferState, is_pasting: Option, last_click: Option, @@ -2209,7 +2209,7 @@ impl State { is_focused: None, dragging_state: None, - #[allow(clippy::default_constructed_unit_structs)] + #[cfg(feature = "wayland")] dnd_offer: DndOfferState::default(), is_pasting: None, last_click: None,