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};
fn test_config(config: Config) {
let watcher = config
let _watcher = config
.watch(|config, keys| {
println!("Changed: {:?}", keys);
for key in keys.iter() {

View file

@ -8,7 +8,6 @@ use cosmic::{
font::load_fonts,
iced::{self, Application, Command, Length, Subscription},
iced::{
subscription,
widget::{self, column, container, horizontal_space, row, text},
window::{self, close, drag, minimize, toggle_maximize},
},
@ -306,10 +305,10 @@ impl Window {
]).into()
}
fn view_unimplemented_sub_page<'a, Message: Clone + From<Page> + 'static>(
&'a self,
fn view_unimplemented_sub_page<Message: Clone + From<Page> + 'static>(
&self,
sub_page: impl SubPage,
) -> Element<'a, Message> {
) -> Element<'_, Message> {
settings::view_column(vec![
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(),

View file

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

View file

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

View file

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

View file

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

View file

@ -640,7 +640,7 @@ where
if cursor_position.is_over(leading_icon_layout.bounds()) {
return leading_icon.as_widget_mut().on_event(
tree,
event.clone(),
event,
leading_icon_layout,
cursor_position,
renderer,
@ -678,7 +678,7 @@ where
if cursor_position.is_over(trailing_icon_layout.bounds()) {
return trailing_icon.as_widget_mut().on_event(
tree,
event.clone(),
event,
trailing_icon_layout,
cursor_position,
renderer,
@ -1579,7 +1579,7 @@ where
}
})));
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
let position = if target > 0.0 {
let value = if is_secure {
@ -1646,7 +1646,7 @@ where
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;