fix clippy issues

This commit is contained in:
reya
2024-12-11 09:11:30 +07:00
parent 516eb0e8bc
commit 10f042acab
49 changed files with 661 additions and 319 deletions
+12 -2
View File
@@ -8,6 +8,8 @@ use gpui::{
use crate::{h_flex, theme::ActiveTheme as _, v_flex, Icon, IconName, Sizable, Size};
type OnToggleClick = Option<Arc<dyn Fn(&[usize], &mut WindowContext) + Send + Sync>>;
/// An AccordionGroup is a container for multiple Accordion elements.
#[derive(IntoElement)]
pub struct Accordion {
@@ -18,7 +20,7 @@ pub struct Accordion {
bordered: bool,
disabled: bool,
children: Vec<AccordionItem>,
on_toggle_click: Option<Arc<dyn Fn(&[usize], &mut WindowContext) + Send + Sync>>,
on_toggle_click: OnToggleClick,
}
impl Accordion {
@@ -138,6 +140,8 @@ impl RenderOnce for Accordion {
}
}
type OnToggle = Option<Arc<dyn Fn(&bool, &mut WindowContext)>>;
/// An Accordion is a vertically stacked list of items, each of which can be expanded to reveal the content associated with it.
#[derive(IntoElement)]
pub struct AccordionItem {
@@ -148,7 +152,7 @@ pub struct AccordionItem {
size: Size,
bordered: bool,
disabled: bool,
on_toggle_click: Option<Arc<dyn Fn(&bool, &mut WindowContext)>>,
on_toggle_click: OnToggle,
}
impl AccordionItem {
@@ -204,6 +208,12 @@ impl AccordionItem {
}
}
impl Default for AccordionItem {
fn default() -> Self {
Self::new()
}
}
impl Sizable for AccordionItem {
fn with_size(mut self, size: impl Into<Size>) -> Self {
self.size = size.into();