chore: Apply clippy lints

This commit is contained in:
Michael Aaron Murphy 2022-12-23 15:10:13 +01:00
parent 03dfc009fd
commit dcbde3b1f2
No known key found for this signature in database
GPG key ID: B2732D4240C9212C
12 changed files with 100 additions and 58 deletions

View file

@ -1,6 +1,8 @@
// Copyright 2022 System76 <info@system76.com> // Copyright 2022 System76 <info@system76.com>
// SPDX-License-Identifier: MPL-2.0 // SPDX-License-Identifier: MPL-2.0
#![allow(clippy::module_name_repetitions)]
pub use iced; pub use iced;
pub use iced_lazy; pub use iced_lazy;
pub use iced_native; pub use iced_native;
@ -21,12 +23,14 @@ pub use theme::Theme;
pub type Renderer = iced::Renderer<Theme>; pub type Renderer = iced::Renderer<Theme>;
pub type Element<'a, Message> = iced::Element<'a, Message, Renderer>; pub type Element<'a, Message> = iced::Element<'a, Message, Renderer>;
#[must_use]
pub fn settings<Flags: Default>() -> iced::Settings<Flags> { pub fn settings<Flags: Default>() -> iced::Settings<Flags> {
let mut settings = iced::Settings::default(); iced::Settings {
settings.default_font = match font::FONT { default_font: match font::FONT {
iced::Font::Default => None, iced::Font::Default => None,
iced::Font::External { bytes, .. } => Some(bytes), iced::Font::External { bytes, .. } => Some(bytes),
}; },
settings.default_text_size = 18; default_text_size: 18,
settings .. iced::Settings::default()
}
} }

View file

@ -144,6 +144,8 @@ impl Default for Button {
} }
impl Button { impl Button {
#[allow(clippy::trivially_copy_pass_by_ref)]
#[allow(clippy::match_same_arms)]
fn cosmic(&self, theme: &Theme) -> &'static CosmicComponent { fn cosmic(&self, theme: &Theme) -> &'static CosmicComponent {
let cosmic = theme.cosmic(); let cosmic = theme.cosmic();
match self { match self {
@ -177,8 +179,7 @@ impl button::StyleSheet for Theme {
_ => 24.0, _ => 24.0,
}, },
background: match style { background: match style {
Button::Text => None, Button::Link | Button::Text => None,
Button::Link => None,
Button::LinkActive => Some(Background::Color(cosmic.divider.into())), Button::LinkActive => Some(Background::Color(cosmic.divider.into())),
_ => Some(Background::Color(cosmic.base.into())), _ => Some(Background::Color(cosmic.base.into())),
}, },
@ -196,7 +197,7 @@ impl button::StyleSheet for Theme {
return hover(self); return hover(self);
} }
let active = self.active(&style); let active = self.active(style);
let cosmic = style.cosmic(self); let cosmic = style.cosmic(self);
button::Appearance { button::Appearance {
@ -416,7 +417,7 @@ impl slider::StyleSheet for Theme {
} }
fn hovered(&self, style: &Self::Style) -> slider::Appearance { fn hovered(&self, style: &Self::Style) -> slider::Appearance {
let mut style = self.active(&style); let mut style = self.active(style);
style.handle.shape = slider::HandleShape::Circle { style.handle.shape = slider::HandleShape::Circle {
radius: 16.0 radius: 16.0
}; };
@ -429,7 +430,7 @@ impl slider::StyleSheet for Theme {
} }
fn dragging(&self, style: &Self::Style) -> slider::Appearance { fn dragging(&self, style: &Self::Style) -> slider::Appearance {
let mut style = self.hovered(&style); let mut style = self.hovered(style);
style.handle.border_color = match self { style.handle.border_color = match self {
Theme::Dark => Color::from_rgba8(0xFF, 0xFF, 0xFF, 0.2), Theme::Dark => Color::from_rgba8(0xFF, 0xFF, 0xFF, 0.2),
Theme::Light => Color::from_rgba8(0, 0, 0, 0.2), Theme::Light => Color::from_rgba8(0, 0, 0, 0.2),
@ -484,7 +485,7 @@ impl pick_list::StyleSheet for Theme {
pick_list::Appearance { pick_list::Appearance {
background: Background::Color(cosmic.hover.into()), background: Background::Color(cosmic.hover.into()),
..self.active(&style) ..self.active(style)
} }
} }
} }
@ -508,7 +509,7 @@ impl radio::StyleSheet for Theme {
} }
fn hovered(&self, style: &Self::Style, is_selected: bool) -> radio::Appearance { fn hovered(&self, style: &Self::Style, is_selected: bool) -> radio::Appearance {
let active = self.active(&style, is_selected); let active = self.active(style, is_selected);
let palette = self.extended_palette(); let palette = self.extended_palette();
radio::Appearance { radio::Appearance {
@ -565,7 +566,7 @@ impl toggler::StyleSheet for Theme {
} else { } else {
Color::from_rgb8(0xb6, 0xb6, 0xb6) Color::from_rgb8(0xb6, 0xb6, 0xb6)
}, },
..self.active(&style, is_active) ..self.active(style, is_active)
}, },
Theme::Light => toggler::Appearance { Theme::Light => toggler::Appearance {
background: if is_active { background: if is_active {
@ -573,7 +574,7 @@ impl toggler::StyleSheet for Theme {
} else { } else {
Color::from_rgb8(0x54, 0x54, 0x54) Color::from_rgb8(0x54, 0x54, 0x54)
}, },
..self.active(&style, is_active) ..self.active(style, is_active)
} }
} }
} }
@ -752,6 +753,7 @@ impl svg::StyleSheet for Theme {
type Style = Svg; type Style = Svg;
fn appearance(&self, style: &Self::Style) -> svg::Appearance { fn appearance(&self, style: &Self::Style) -> svg::Appearance {
#[allow(clippy::match_same_arms)]
match style { match style {
Svg::Default => svg::Appearance::default(), Svg::Default => svg::Appearance::default(),
Svg::Custom(appearance) => appearance(self), Svg::Custom(appearance) => appearance(self),

View file

@ -17,6 +17,7 @@ pub struct Palette {
} }
impl Palette { impl Palette {
#[allow(clippy::cast_precision_loss)]
pub const LIGHT: Self = Self { pub const LIGHT: Self = Self {
background: Color::from_rgb( background: Color::from_rgb(
0xee as f32 / 255.0, 0xee as f32 / 255.0,
@ -45,6 +46,7 @@ impl Palette {
), ),
}; };
#[allow(clippy::cast_precision_loss)]
pub const DARK: Self = Self { pub const DARK: Self = Self {
background: Color::from_rgb( background: Color::from_rgb(
0x1e as f32 / 255.0, 0x1e as f32 / 255.0,
@ -107,6 +109,7 @@ pub struct Pair {
} }
impl Pair { impl Pair {
#[must_use]
pub fn new(color: Color, text: Color) -> Self { pub fn new(color: Color, text: Color) -> Self {
Self { Self {
color, color,

View file

@ -67,60 +67,70 @@ where
} }
/// Sets the [`Padding`] of the [`Container`]. /// Sets the [`Padding`] of the [`Container`].
#[must_use]
pub fn padding<P: Into<Padding>>(mut self, padding: P) -> Self { pub fn padding<P: Into<Padding>>(mut self, padding: P) -> Self {
self.container = self.container.padding(padding); self.container = self.container.padding(padding);
self self
} }
/// Sets the width of the [`self.`]. /// Sets the width of the [`self.`].
#[must_use]
pub fn width(mut self, width: Length) -> Self { pub fn width(mut self, width: Length) -> Self {
self.container = self.container.width(width); self.container = self.container.width(width);
self self
} }
/// Sets the height of the [`Container`]. /// Sets the height of the [`Container`].
#[must_use]
pub fn height(mut self, height: Length) -> Self { pub fn height(mut self, height: Length) -> Self {
self.container = self.container.height(height); self.container = self.container.height(height);
self self
} }
/// Sets the maximum width of the [`Container`]. /// Sets the maximum width of the [`Container`].
#[must_use]
pub fn max_width(mut self, max_width: u32) -> Self { pub fn max_width(mut self, max_width: u32) -> Self {
self.container = self.container.max_width(max_width); self.container = self.container.max_width(max_width);
self self
} }
/// Sets the maximum height of the [`Container`] in pixels. /// Sets the maximum height of the [`Container`] in pixels.
#[must_use]
pub fn max_height(mut self, max_height: u32) -> Self { pub fn max_height(mut self, max_height: u32) -> Self {
self.container = self.container.max_height(max_height); self.container = self.container.max_height(max_height);
self self
} }
/// Sets the content alignment for the horizontal axis of the [`Container`]. /// Sets the content alignment for the horizontal axis of the [`Container`].
#[must_use]
pub fn align_x(mut self, alignment: alignment::Horizontal) -> Self { pub fn align_x(mut self, alignment: alignment::Horizontal) -> Self {
self.container = self.container.align_x(alignment); self.container = self.container.align_x(alignment);
self self
} }
/// Sets the content alignment for the vertical axis of the [`Container`]. /// Sets the content alignment for the vertical axis of the [`Container`].
#[must_use]
pub fn align_y(mut self, alignment: alignment::Vertical) -> Self { pub fn align_y(mut self, alignment: alignment::Vertical) -> Self {
self.container = self.container.align_y(alignment); self.container = self.container.align_y(alignment);
self self
} }
/// Centers the contents in the horizontal axis of the [`Container`]. /// Centers the contents in the horizontal axis of the [`Container`].
#[must_use]
pub fn center_x(mut self) -> Self { pub fn center_x(mut self) -> Self {
self.container = self.container.center_x(); self.container = self.container.center_x();
self self
} }
/// Centers the contents in the vertical axis of the [`Container`]. /// Centers the contents in the vertical axis of the [`Container`].
#[must_use]
pub fn center_y(mut self) -> Self { pub fn center_y(mut self) -> Self {
self.container = self.container.center_y(); self.container = self.container.center_y();
self self
} }
/// Sets the style of the [`Container`]. /// Sets the style of the [`Container`].
#[must_use]
pub fn style(mut self, style: impl Into<<Renderer::Theme as StyleSheet>::Style>) -> Self { pub fn style(mut self, style: impl Into<<Renderer::Theme as StyleSheet>::Style>) -> Self {
self.container = self.container.style(style); self.container = self.container.style(style);
self self
@ -155,7 +165,7 @@ where
} }
fn operate(&self, tree: &mut Tree, layout: Layout<'_>, operation: &mut dyn Operation<Message>) { fn operate(&self, tree: &mut Tree, layout: Layout<'_>, operation: &mut dyn Operation<Message>) {
self.container.operate(tree, layout, operation) self.container.operate(tree, layout, operation);
} }
fn on_event( fn on_event(
@ -209,7 +219,7 @@ where
layout, layout,
cursor_position, cursor_position,
viewport, viewport,
) );
} }
fn overlay<'b>( fn overlay<'b>(

View file

@ -7,9 +7,8 @@ use iced::{
widget::{svg, Image}, widget::{svg, Image},
Length, ContentFit, Length, ContentFit,
}; };
use std::{borrow::{Cow, Borrow}, ffi::OsStr, path::Path}; use std::{borrow::Cow, collections::hash_map::DefaultHasher, ffi::OsStr, hash::Hasher, path::Path};
use std::hash::Hash; use std::hash::Hash;
use std::rc::Rc;
use derive_setters::Setters; use derive_setters::Setters;
use crate::{Element, Renderer}; use crate::{Element, Renderer};
@ -97,46 +96,46 @@ impl<'a> Icon<'a> {
return image.into(); return image.into();
} }
let element = Rc::new(self); let mut hasher = DefaultHasher::new();
let element_clone = Rc::clone(&element); self.hash(&mut hasher);
iced_lazy::lazy(element_clone, move || -> Element<Message> { iced_lazy::lazy(hasher.finish(), move || -> Element<Message> {
let icon = match &element.name { let icon = match &self.name {
IconSource::Path(path) => Some(Cow::from(*path)), IconSource::Path(path) => Some(Cow::from(*path)),
IconSource::Name(name) => { IconSource::Name(name) => {
let icon = freedesktop_icons::lookup(&name) let icon = freedesktop_icons::lookup(name)
.with_size(element.size) .with_size(self.size)
.with_theme(&element.theme) .with_theme(&self.theme)
.with_cache() .with_cache()
.find(); .find();
if icon.is_none() { if icon.is_none() {
freedesktop_icons::lookup(&name) freedesktop_icons::lookup(name)
.with_size(element.size) .with_size(self.size)
.with_cache() .with_cache()
.find() .find()
} else { } else {
icon icon
}.map(|p| Cow::from(p)) }.map(Cow::from)
}, },
IconSource::Embedded(_) => unimplemented!(), IconSource::Embedded(_) => unimplemented!(),
}; };
let is_svg = element.force_svg || icon.as_ref().map(|path| path.extension() == Some(&OsStr::new("svg"))).unwrap_or(true); let is_svg = self.force_svg || icon.as_ref().map_or(true, |path| path.extension() == Some(OsStr::new("svg")));
if is_svg { if is_svg {
let handle = if let Some(path) = icon { let handle = if let Some(path) = icon {
svg::Handle::from_path(path) svg::Handle::from_path(path)
} else { } else {
eprintln!("icon '{:?}' size {} not found", &element.name, element.size); eprintln!("icon '{:?}' size {} not found", &self.name, self.size);
svg::Handle::from_memory(Vec::new()) svg::Handle::from_memory(Vec::new())
}; };
let mut widget = svg::Svg::<Renderer>::new(handle) let mut widget = svg::Svg::<Renderer>::new(handle)
.style(element.style) .style(self.style)
.width(element.width.unwrap_or(Length::Units(element.size))) .width(self.width.unwrap_or(Length::Units(self.size)))
.height(element.height.unwrap_or(Length::Units(element.size))); .height(self.height.unwrap_or(Length::Units(self.size)));
if let Some(content_fit) = element.content_fit { if let Some(content_fit) = self.content_fit {
widget = widget.content_fit(content_fit); widget = widget.content_fit(content_fit);
} }
@ -144,9 +143,9 @@ impl<'a> Icon<'a> {
} else { } else {
let icon_path = icon.unwrap(); let icon_path = icon.unwrap();
let mut image = Image::new(icon_path) let mut image = Image::new(icon_path)
.width(element.width.unwrap_or(Length::Units(element.size))) .width(self.width.unwrap_or(Length::Units(self.size)))
.height(element.height.unwrap_or(Length::Units(element.size))); .height(self.height.unwrap_or(Length::Units(self.size)));
if let Some(content_fit) = element.content_fit { if let Some(content_fit) = self.content_fit {
image = image.content_fit(content_fit); image = image.content_fit(content_fit);
} }
image.into() image.into()

View file

@ -22,11 +22,13 @@ impl<'a, Message: 'static> Default for ListColumn<'a, Message> {
} }
impl<'a, Message: 'static> ListColumn<'a, Message> { impl<'a, Message: 'static> ListColumn<'a, Message> {
#[must_use]
pub fn new() -> Self { pub fn new() -> Self {
Self::default() Self::default()
} }
#[must_use] #[must_use]
#[allow(clippy::should_implement_trait)]
pub fn add(mut self, item: impl Into<Element<'a, Message>>) -> Self { pub fn add(mut self, item: impl Into<Element<'a, Message>>) -> Self {
if !self.children.is_empty() { if !self.children.is_empty() {
self.children.push(horizontal_rule(10).into()); self.children.push(horizontal_rule(10).into());
@ -53,6 +55,8 @@ impl<'a, Message: 'static> From<ListColumn<'a, Message>> for Element<'a, Message
} }
} }
#[must_use]
#[allow(clippy::trivially_copy_pass_by_ref)]
pub fn style(theme: &crate::Theme) -> iced::widget::container::Appearance { pub fn style(theme: &crate::Theme) -> iced::widget::container::Appearance {
let cosmic = &theme.cosmic().primary; let cosmic = &theme.cosmic().primary;
iced::widget::container::Appearance { iced::widget::container::Appearance {

View file

@ -21,9 +21,10 @@ pub struct NavBar<'a, Message> {
} }
impl<'a, Message> NavBar<'a, Message> { impl<'a, Message> NavBar<'a, Message> {
#[must_use]
pub fn new() -> Self { pub fn new() -> Self {
Self { Self {
source: Default::default(), source: BTreeMap::default(),
active: false, active: false,
condensed: false, condensed: false,
on_page_selected: None, on_page_selected: None,
@ -31,6 +32,7 @@ impl<'a, Message> NavBar<'a, Message> {
} }
} }
#[must_use]
pub fn nav_bar<'a, Message>() -> NavBar<'a, Message> { pub fn nav_bar<'a, Message>() -> NavBar<'a, Message> {
NavBar::new() NavBar::new()
} }
@ -44,11 +46,13 @@ pub struct NavBarSection {
} }
impl NavBarSection { impl NavBarSection {
#[must_use]
pub fn new() -> Self { pub fn new() -> Self {
Self::default() Self::default()
} }
} }
#[must_use]
pub fn nav_bar_section() -> NavBarSection { pub fn nav_bar_section() -> NavBarSection {
NavBarSection::new() NavBarSection::new()
} }
@ -60,6 +64,7 @@ pub struct NavBarPage {
} }
impl NavBarPage { impl NavBarPage {
#[must_use]
pub fn new() -> Self { pub fn new() -> Self {
Self { Self {
title: String::new(), title: String::new(),
@ -67,6 +72,7 @@ impl NavBarPage {
} }
} }
#[must_use]
pub fn nav_bar_page(title: &str) -> NavBarPage { pub fn nav_bar_page(title: &str) -> NavBarPage {
let mut page = NavBarPage::new(); let mut page = NavBarPage::new();
page.title = title.to_string(); page.title = title.to_string();
@ -136,9 +142,9 @@ impl<'a, Message> Component<Message, Renderer> for NavBar<'a, Message> {
) )
.style( .style(
if *section == state.selected_section && state.section_active { if *section == state.selected_section && state.section_active {
theme::Button::Primary.into() theme::Button::Primary
} else { } else {
theme::Button::Text.into() theme::Button::Text
}, },
) )
.on_press(NavBarEvent::SectionSelected(section.clone())) .on_press(NavBarEvent::SectionSelected(section.clone()))
@ -151,12 +157,12 @@ impl<'a, Message> Component<Message, Renderer> for NavBar<'a, Message> {
.padding(10) .padding(10)
.style(if let Some(selected_page) = &state.selected_page { .style(if let Some(selected_page) = &state.selected_page {
if state.page_active && page == selected_page { if state.page_active && page == selected_page {
theme::Button::Primary.into() theme::Button::Primary
} else { } else {
theme::Button::Text.into() theme::Button::Text
} }
} else { } else {
theme::Button::Text.into() theme::Button::Text
}) })
.on_press(NavBarEvent::PageSelected(section.clone(), page.clone())) .on_press(NavBarEvent::PageSelected(section.clone(), page.clone()))
.into(), .into(),
@ -218,14 +224,15 @@ impl<'a, Message: 'static> From<NavBar<'a, Message>>
} }
} }
#[must_use]
pub fn section_button_style(theme: &Theme) -> Appearance { pub fn section_button_style(theme: &Theme) -> Appearance {
let primary = &theme.cosmic().primary; let primary = &theme.cosmic().primary;
Appearance { Appearance {
shadow_offset: Default::default(), shadow_offset: iced::Vector::default(),
background: Some(Background::Color(primary.base.into())), background: Some(Background::Color(primary.base.into())),
border_radius: 5.0, border_radius: 5.0,
border_width: 0.0, border_width: 0.0,
border_color: Default::default(), border_color: iced::Color::default(),
text_color: Default::default(), text_color: iced::Color::default(),
} }
} }

View file

@ -71,60 +71,70 @@ where
} }
/// Sets the [`Padding`] of the [`Container`]. /// Sets the [`Padding`] of the [`Container`].
#[must_use]
pub fn padding<P: Into<Padding>>(mut self, padding: P) -> Self { pub fn padding<P: Into<Padding>>(mut self, padding: P) -> Self {
self.container = self.container.padding(padding); self.container = self.container.padding(padding);
self self
} }
/// Sets the width of the [`self.`]. /// Sets the width of the [`self.`].
#[must_use]
pub fn width(mut self, width: Length) -> Self { pub fn width(mut self, width: Length) -> Self {
self.container = self.container.width(width); self.container = self.container.width(width);
self self
} }
/// Sets the height of the [`Container`]. /// Sets the height of the [`Container`].
#[must_use]
pub fn height(mut self, height: Length) -> Self { pub fn height(mut self, height: Length) -> Self {
self.container = self.container.height(height); self.container = self.container.height(height);
self self
} }
/// Sets the maximum width of the [`Container`]. /// Sets the maximum width of the [`Container`].
#[must_use]
pub fn max_width(mut self, max_width: u32) -> Self { pub fn max_width(mut self, max_width: u32) -> Self {
self.container = self.container.max_width(max_width); self.container = self.container.max_width(max_width);
self self
} }
/// Sets the maximum height of the [`Container`] in pixels. /// Sets the maximum height of the [`Container`] in pixels.
#[must_use]
pub fn max_height(mut self, max_height: u32) -> Self { pub fn max_height(mut self, max_height: u32) -> Self {
self.container = self.container.max_height(max_height); self.container = self.container.max_height(max_height);
self self
} }
/// Sets the content alignment for the horizontal axis of the [`Container`]. /// Sets the content alignment for the horizontal axis of the [`Container`].
#[must_use]
pub fn align_x(mut self, alignment: alignment::Horizontal) -> Self { pub fn align_x(mut self, alignment: alignment::Horizontal) -> Self {
self.container = self.container.align_x(alignment); self.container = self.container.align_x(alignment);
self self
} }
/// Sets the content alignment for the vertical axis of the [`Container`]. /// Sets the content alignment for the vertical axis of the [`Container`].
#[must_use]
pub fn align_y(mut self, alignment: alignment::Vertical) -> Self { pub fn align_y(mut self, alignment: alignment::Vertical) -> Self {
self.container = self.container.align_y(alignment); self.container = self.container.align_y(alignment);
self self
} }
/// Centers the contents in the horizontal axis of the [`Container`]. /// Centers the contents in the horizontal axis of the [`Container`].
#[must_use]
pub fn center_x(mut self) -> Self { pub fn center_x(mut self) -> Self {
self.container = self.container.center_x(); self.container = self.container.center_x();
self self
} }
/// Centers the contents in the vertical axis of the [`Container`]. /// Centers the contents in the vertical axis of the [`Container`].
#[must_use]
pub fn center_y(mut self) -> Self { pub fn center_y(mut self) -> Self {
self.container = self.container.center_y(); self.container = self.container.center_y();
self self
} }
/// Sets the style of the [`Container`]. /// Sets the style of the [`Container`].
#[must_use]
pub fn style(mut self, style: impl Into<<Renderer::Theme as StyleSheet>::Style>) -> Self { pub fn style(mut self, style: impl Into<<Renderer::Theme as StyleSheet>::Style>) -> Self {
self.container = self.container.style(style); self.container = self.container.style(style);
self self
@ -159,7 +169,7 @@ where
} }
fn operate(&self, tree: &mut Tree, layout: Layout<'_>, operation: &mut dyn Operation<Message>) { fn operate(&self, tree: &mut Tree, layout: Layout<'_>, operation: &mut dyn Operation<Message>) {
self.container.operate(tree, layout, operation) self.container.operate(tree, layout, operation);
} }
fn on_event( fn on_event(
@ -215,7 +225,7 @@ where
layout, layout,
cursor_position, cursor_position,
viewport, viewport,
) );
} }
fn overlay<'b>( fn overlay<'b>(

View file

@ -32,10 +32,10 @@ async fn start_listening<I: Copy, R: 'static + Hash + Copy + Send + Sync + Debug
State::Ready => { State::Ready => {
let (tx, rx) = unbounded(); let (tx, rx) = unbounded();
return ( (
Some((id, RectangleUpdate::Init(RectangleTracker { tx }))), Some((id, RectangleUpdate::Init(RectangleTracker { tx }))),
State::Waiting(rx, HashMap::new()), State::Waiting(rx, HashMap::new()),
); )
} }
State::Waiting(mut rx, mut map) => match rx.next().await { State::Waiting(mut rx, mut map) => match rx.next().await {
Some(u) => Some(u) =>
@ -56,7 +56,7 @@ async fn start_listening<I: Copy, R: 'static + Hash + Copy + Send + Sync + Debug
State::Waiting(rx, map), State::Waiting(rx, map),
); );
} }
return (None, State::Waiting(rx, map)) (None, State::Waiting(rx, map))
}, },
None => (None, State::Finished), None => (None, State::Finished),

View file

@ -14,6 +14,7 @@ pub fn vertical_rule(size: u16) -> widget::Rule<Renderer> {
widget::vertical_rule(size).style(theme::Rule::Custom(separator_style)) widget::vertical_rule(size).style(theme::Rule::Custom(separator_style))
} }
#[allow(clippy::trivially_copy_pass_by_ref)]
fn separator_style(theme: &Theme) -> widget::rule::Appearance { fn separator_style(theme: &Theme) -> widget::rule::Appearance {
let cosmic = &theme.cosmic().primary; let cosmic = &theme.cosmic().primary;
widget::rule::Appearance { widget::rule::Appearance {

View file

@ -22,6 +22,7 @@ pub struct Section<'a, Message> {
impl<'a, Message: 'static> Section<'a, Message> { impl<'a, Message: 'static> Section<'a, Message> {
#[must_use] #[must_use]
#[allow(clippy::should_implement_trait)]
pub fn add(mut self, item: impl Into<Element<'a, Message>>) -> Self { pub fn add(mut self, item: impl Into<Element<'a, Message>>) -> Self {
self.children = self.children.add(item.into()); self.children = self.children.add(item.into());
self self

View file

@ -105,6 +105,7 @@ impl<'a, T: 'static + Copy + Hash + ToString, Message: 'static> From<SpinButton<
} }
} }
#[allow(clippy::trivially_copy_pass_by_ref)]
fn container_style(theme: &crate::Theme) -> iced_style::container::Appearance { fn container_style(theme: &crate::Theme) -> iced_style::container::Appearance {
let secondary = &theme.cosmic().secondary; let secondary = &theme.cosmic().secondary;
let accent = &theme.cosmic().accent; let accent = &theme.cosmic().accent;