remove redundant clones (clippy::redundant_clone)

This commit is contained in:
Daniel Eades 2023-12-10 16:30:53 +00:00
parent 74ee508427
commit 12a5804fa7
7 changed files with 14 additions and 17 deletions

View file

@ -4,7 +4,7 @@
use cosmic_config::{Config, ConfigGet, ConfigSet}; use cosmic_config::{Config, ConfigGet, ConfigSet};
fn test_config(config: Config) { fn test_config(config: Config) {
let watcher = config let _watcher = config
.watch(|config, keys| { .watch(|config, keys| {
println!("Changed: {:?}", keys); println!("Changed: {:?}", keys);
for key in keys.iter() { for key in keys.iter() {

View file

@ -8,7 +8,6 @@ use cosmic::{
font::load_fonts, font::load_fonts,
iced::{self, Application, Command, Length, Subscription}, iced::{self, Application, Command, Length, Subscription},
iced::{ iced::{
subscription,
widget::{self, column, container, horizontal_space, row, text}, widget::{self, column, container, horizontal_space, row, text},
window::{self, close, drag, minimize, toggle_maximize}, window::{self, close, drag, minimize, toggle_maximize},
}, },
@ -306,10 +305,10 @@ impl Window {
]).into() ]).into()
} }
fn view_unimplemented_sub_page<'a, Message: Clone + From<Page> + 'static>( fn view_unimplemented_sub_page<Message: Clone + From<Page> + 'static>(
&'a self, &self,
sub_page: impl SubPage, sub_page: impl SubPage,
) -> Element<'a, Message> { ) -> Element<'_, Message> {
settings::view_column(vec![ settings::view_column(vec![
self.parent_page_button(sub_page), self.parent_page_button(sub_page),
text("We haven't created that panel yet, and/or it is using a similar idea as current Pop! designs.").into(), text("We haven't created that panel yet, and/or it is using a similar idea as current Pop! designs.").into(),

View file

@ -5,7 +5,7 @@ use cosmic::{
iced::{self, event, window}, iced::{self, event, window},
iced_core::{id, Alignment, Length, Point}, iced_core::{id, Alignment, Length, Point},
iced_widget::{column, container, scrollable, text, text_input}, iced_widget::{column, container, scrollable, text, text_input},
widget::{button, cosmic_container}, widget::button,
Command, Command,
}; };

View file

@ -101,7 +101,7 @@ pub(crate) fn iced_settings<App: Application>(
autosize: settings.autosize, autosize: settings.autosize,
client_decorations: settings.client_decorations, client_decorations: settings.client_decorations,
resizable: settings.resizable, resizable: settings.resizable,
size: (settings.size.width as u32, settings.size.height as u32).into(), size: (settings.size.width as u32, settings.size.height as u32),
size_limits: settings.size_limits, size_limits: settings.size_limits,
title: None, title: None,
transparent: settings.transparent, transparent: settings.transparent,
@ -567,9 +567,7 @@ impl<App: Application> ApplicationExt for App {
#[cfg(not(feature = "multi-window"))] #[cfg(not(feature = "multi-window"))]
fn set_window_title(&mut self, title: String) -> iced::Command<Message<Self::Message>> { fn set_window_title(&mut self, title: String) -> iced::Command<Message<Self::Message>> {
self.core_mut() self.core_mut().title.insert(window::Id::MAIN, title);
.title
.insert(window::Id::MAIN, title.clone());
iced::Command::none() iced::Command::none()
} }

View file

@ -34,7 +34,7 @@ where
let mut node = self let mut node = self
.content .content
.as_widget() .as_widget()
.layout(&mut self.tree, renderer, &limits); .layout(self.tree, renderer, &limits);
let node_size = node.size(); let node_size = node.size();
node.move_to(Point { node.move_to(Point {

View file

@ -484,8 +484,8 @@ where
(root, Vec::new()), (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 slice = ms.slice(bounds, overlay_offset, self.item_height);
let start_index = slice.start_index; let _start_index = slice.start_index;
let end_index = slice.end_index; let _end_index = slice.end_index;
let children_node = ms.layout( let children_node = ms.layout(
overlay_offset, overlay_offset,
slice, slice,

View file

@ -640,7 +640,7 @@ where
if cursor_position.is_over(leading_icon_layout.bounds()) { if cursor_position.is_over(leading_icon_layout.bounds()) {
return leading_icon.as_widget_mut().on_event( return leading_icon.as_widget_mut().on_event(
tree, tree,
event.clone(), event,
leading_icon_layout, leading_icon_layout,
cursor_position, cursor_position,
renderer, renderer,
@ -678,7 +678,7 @@ where
if cursor_position.is_over(trailing_icon_layout.bounds()) { if cursor_position.is_over(trailing_icon_layout.bounds()) {
return trailing_icon.as_widget_mut().on_event( return trailing_icon.as_widget_mut().on_event(
tree, tree,
event.clone(), event,
trailing_icon_layout, trailing_icon_layout,
cursor_position, cursor_position,
renderer, renderer,
@ -1579,7 +1579,7 @@ where
} }
}))); })));
let target = x as f32 - text_layout.bounds().x; let target = x as f32 - text_layout.bounds().x;
state.dnd_offer = DndOfferState::HandlingOffer(mime_types.clone(), DndAction::None); state.dnd_offer = DndOfferState::HandlingOffer(mime_types, DndAction::None);
// existing logic for setting the selection // existing logic for setting the selection
let position = if target > 0.0 { let position = if target > 0.0 {
let value = if is_secure { let value = if is_secure {
@ -1646,7 +1646,7 @@ where
accepted: DndAction::Move.union(DndAction::Copy), accepted: DndAction::Move.union(DndAction::Copy),
} }
}))); })));
state.dnd_offer = DndOfferState::HandlingOffer(mime_types.clone(), action); state.dnd_offer = DndOfferState::HandlingOffer(mime_types, action);
} }
}; };
let target = x as f32 - text_layout.bounds().x; let target = x as f32 - text_layout.bounds().x;