cargo fmt

This commit is contained in:
Ashley Wulber 2025-02-28 12:42:59 -05:00
parent 76930d8624
commit e9e01af77d
No known key found for this signature in database
GPG key ID: 5216D4F46A90A820
17 changed files with 27 additions and 73 deletions

View file

@ -4,10 +4,10 @@
use std::collections::HashMap;
use crate::widget::{
button, icon,
menu::{self},
nav_bar, responsive_container,
};
button, icon,
menu::{self},
nav_bar, responsive_container,
};
use cosmic_config::CosmicConfigEntry;
use cosmic_theme::ThemeMode;
use iced::{window, Limits, Size};
@ -17,7 +17,6 @@ use slotmap::Key;
use crate::Theme;
/// Status of the nav bar and its panels.
#[derive(Clone)]
pub struct NavBar {
@ -403,10 +402,6 @@ impl Core {
Vec<menu::Item<A, std::borrow::Cow<'static, str>>>,
)>,
) -> crate::Element<'a, Message> {
use crate::widget::id_container;
let menu_bar_size = self.menu_bars.get(&id);

View file

@ -6,7 +6,6 @@
//! Check out our [application](https://github.com/pop-os/libcosmic/tree/master/examples/application)
//! example in our repository.
pub mod command;
pub mod context_drawer;
mod core;
@ -18,8 +17,6 @@ pub mod settings;
pub mod message {
use crate::surface_message::SurfaceMessage;
#[derive(Clone, Debug)]
#[must_use]
pub enum Message<M> {
@ -549,7 +546,8 @@ where
} else {
p.activate(platform_data)
}
}; match res {
};
match res {
Ok(()) => {
tracing::info!("Successfully activated another instance");
true

View file

@ -25,12 +25,7 @@ use cosmic_panel_config::{CosmicPanelBackground, PanelAnchor, PanelSize};
use iced_core::{Layout, Padding, Shadow};
use iced_widget::runtime::platform_specific::wayland::popup::{SctkPopupSettings, SctkPositioner};
use sctk::reexports::protocols::xdg::shell::client::xdg_positioner::{Anchor, Gravity};
use std::{
borrow::Cow,
num::NonZeroU32,
rc::Rc,
sync::LazyLock,
};
use std::{borrow::Cow, num::NonZeroU32, rc::Rc, sync::LazyLock};
use tracing::info;
use crate::app::cosmic;
@ -166,11 +161,7 @@ impl Context {
let height = f32::from(height) + applet_padding as f32 * 2.;
let mut settings = crate::app::Settings::default()
.size(iced_core::Size::new(width, height))
.size_limits(
Limits::NONE
.min_height(height)
.min_width(width),
)
.size_limits(Limits::NONE.min_height(height).min_width(width))
.resizable(None)
.default_text_size(14.0)
.default_font(crate::font::default())

View file

@ -152,7 +152,8 @@ impl From<FontConfig> for iced::Font {
let mut family_map = FAMILY_MAP.lock().unwrap();
let name: &'static str = family_map
.get(font.family.as_str()).copied()
.get(font.family.as_str())
.copied()
.unwrap_or_else(|| {
let value = font.family.clone().leak();
family_map.insert(value);

View file

@ -753,9 +753,7 @@ impl slider::Catalog for Theme {
impl menu::Catalog for Theme {
type Class<'a> = ();
fn default<'a>() -> <Self as menu::Catalog>::Class<'a> {
}
fn default<'a>() -> <Self as menu::Catalog>::Class<'a> {}
fn style(&self, class: &<Self as menu::Catalog>::Class<'_>) -> menu::Style {
let cosmic = self.cosmic();
@ -776,9 +774,7 @@ impl menu::Catalog for Theme {
impl pick_list::Catalog for Theme {
type Class<'a> = ();
fn default<'a>() -> <Self as pick_list::Catalog>::Class<'a> {
}
fn default<'a>() -> <Self as pick_list::Catalog>::Class<'a> {}
fn style(
&self,
@ -821,9 +817,7 @@ impl pick_list::Catalog for Theme {
impl radio::Catalog for Theme {
type Class<'a> = ();
fn default<'a>() -> Self::Class<'a> {
}
fn default<'a>() -> Self::Class<'a> {}
fn style(&self, class: &Self::Class<'_>, status: radio::Status) -> radio::Style {
let theme = self.cosmic();
@ -875,9 +869,7 @@ impl radio::Catalog for Theme {
impl toggler::Catalog for Theme {
type Class<'a> = ();
fn default<'a>() -> Self::Class<'a> {
}
fn default<'a>() -> Self::Class<'a> {}
fn style(&self, class: &Self::Class<'_>, status: toggler::Status) -> toggler::Style {
let cosmic = self.cosmic();
@ -932,9 +924,7 @@ impl toggler::Catalog for Theme {
impl pane_grid::Catalog for Theme {
type Class<'a> = ();
fn default<'a>() -> <Self as pane_grid::Catalog>::Class<'a> {
}
fn default<'a>() -> <Self as pane_grid::Catalog>::Class<'a> {}
fn style(&self, class: &<Self as pane_grid::Catalog>::Class<'_>) -> pane_grid::Style {
let theme = self.cosmic();

View file

@ -593,12 +593,7 @@ impl<'a, Message: 'a + Clone> Widget<Message, crate::Theme, crate::Renderer>
}
match self.description.as_ref() {
Some(iced_accessibility::Description::Id(id)) => {
node.set_described_by(
id.iter()
.cloned()
.map(NodeId::from)
.collect::<Vec<_>>(),
);
node.set_described_by(id.iter().cloned().map(NodeId::from).collect::<Vec<_>>());
}
Some(iced_accessibility::Description::Text(text)) => {
node.set_description(text.clone());

View file

@ -17,8 +17,7 @@ pub(super) struct Overlay<'a, 'b, Message> {
pub(super) width: f32,
}
impl<Message> overlay::Overlay<Message, crate::Theme, crate::Renderer>
for Overlay<'_, '_, Message>
impl<Message> overlay::Overlay<Message, crate::Theme, crate::Renderer> for Overlay<'_, '_, Message>
where
Message: Clone,
{

View file

@ -46,9 +46,7 @@ pub struct ContextMenu<'a, Message> {
context_menu: Option<Vec<menu::Tree<'a, Message>>>,
}
impl<Message: Clone> Widget<Message, crate::Theme, crate::Renderer>
for ContextMenu<'_, Message>
{
impl<Message: Clone> Widget<Message, crate::Theme, crate::Renderer> for ContextMenu<'_, Message> {
fn tag(&self) -> tree::Tag {
tree::Tag::of::<LocalState>()
}

View file

@ -417,8 +417,7 @@ where
text_line_height: text::LineHeight,
}
impl<S: AsRef<str>, Message> Widget<Message, crate::Theme, crate::Renderer>
for List<'_, S, Message>
impl<S: AsRef<str>, Message> Widget<Message, crate::Theme, crate::Renderer> for List<'_, S, Message>
where
[S]: std::borrow::ToOwned,
{

View file

@ -180,9 +180,7 @@ impl<'a, Message: 'a> Overlay<'a, Message> {
}
}
impl<Message> iced_core::Overlay<Message, crate::Theme, crate::Renderer>
for Overlay<'_, Message>
{
impl<Message> iced_core::Overlay<Message, crate::Theme, crate::Renderer> for Overlay<'_, Message> {
fn layout(&mut self, renderer: &crate::Renderer, bounds: Size) -> layout::Node {
let position = self.position;
let space_below = bounds.height - (position.y + self.target_height);

View file

@ -85,9 +85,7 @@ impl<'a, Message> FlexRow<'a, Message> {
}
}
impl<Message: 'static + Clone> Widget<Message, crate::Theme, Renderer>
for FlexRow<'_, Message>
{
impl<Message: 'static + Clone> Widget<Message, crate::Theme, Renderer> for FlexRow<'_, Message> {
fn children(&self) -> Vec<Tree> {
self.children.iter().map(Tree::new).collect()
}

View file

@ -138,8 +138,7 @@ where
}
}
impl<Message, Renderer> Widget<Message, Theme, Renderer>
for LayerContainer<'_, Message, Renderer>
impl<Message, Renderer> Widget<Message, Theme, Renderer> for LayerContainer<'_, Message, Renderer>
where
Renderer: iced_core::Renderer,
{

View file

@ -280,8 +280,7 @@ where
self
}
}
impl<Message, Renderer> Widget<Message, crate::Theme, Renderer>
for MenuBar<'_, Message, Renderer>
impl<Message, Renderer> Widget<Message, crate::Theme, Renderer> for MenuBar<'_, Message, Renderer>
where
Renderer: renderer::Renderer,
{

View file

@ -345,7 +345,6 @@ pub mod wayland;
pub mod tooltip {
use crate::Element;
pub use iced::widget::tooltip::Position;
pub type Tooltip<'a, Message> =

View file

@ -20,9 +20,7 @@ pub fn section<'a, Message: 'static>() -> Section<'a, Message> {
}
/// A section with a pre-defined list column.
pub fn with_column<Message: 'static>(
children: ListColumn<'_, Message>,
) -> Section<'_, Message> {
pub fn with_column<Message: 'static>(children: ListColumn<'_, Message>) -> Section<'_, Message> {
Section {
title: Cow::Borrowed(""),
children,

View file

@ -9,10 +9,10 @@ use crate::{
Element,
};
use apply::Apply;
use iced::{Border, Shadow};
use iced::{Alignment, Length};
use std::ops::{Add, Sub};
use iced::{Border, Shadow};
use std::borrow::Cow;
use std::ops::{Add, Sub};
/// Horizontal spin button widget.
pub fn spin_button<'a, T, M>(
@ -151,9 +151,7 @@ where
}
}
fn horizontal_variant<T, Message>(
spin_button: SpinButton<'_, T, Message>,
) -> Element<'_, Message>
fn horizontal_variant<T, Message>(spin_button: SpinButton<'_, T, Message>) -> Element<'_, Message>
where
Message: Clone + 'static,
T: Copy + Sub<Output = T> + Add<Output = T> + PartialOrd,

View file

@ -20,7 +20,6 @@ use iced_core::{
Background, Clipboard, Color, Layout, Length, Padding, Point, Rectangle, Shell, Vector, Widget,
};
pub use super::{Catalog, Style};
/// Internally defines different button widget variants.