Fix clippy lints

This commit is contained in:
Ian Douglas Scott 2024-04-24 13:51:20 -07:00
parent 3dd5a28e28
commit 7997d58ce7
7 changed files with 11 additions and 25 deletions

View file

@ -99,7 +99,7 @@ impl AppData {
x.format == format
&& (!needs_linear || x.modifier == u64::from(gbm::Modifier::Linear))
})
.filter_map(|x| gbm::Modifier::try_from(x.modifier).ok())
.map(|x| gbm::Modifier::from(x.modifier))
.collect::<Vec<_>>();
if modifiers.is_empty() {

View file

@ -128,7 +128,7 @@ enum Msg {
SourceFinished,
#[allow(dead_code)]
NewWorkspace,
CompConfig(CosmicCompConfig),
CompConfig(Box<CosmicCompConfig>),
Config(CosmicWorkspacesConfig),
}
@ -176,20 +176,12 @@ enum DragSurface {
},
}
#[derive(Default)]
struct Conf {
workspace_config: cosmic_comp_config::workspace::WorkspaceConfig,
config: CosmicWorkspacesConfig,
}
impl Default for Conf {
fn default() -> Self {
Self {
workspace_config: Default::default(),
config: Default::default(),
}
}
}
#[derive(Default)]
struct App {
layer_surfaces: HashMap<SurfaceId, LayerSurface>,
@ -619,7 +611,7 @@ impl Application for App {
if !update.errors.is_empty() {
log::error!("Failed to load compositor config: {:?}", update.errors);
}
Msg::CompConfig(update.config)
Msg::CompConfig(Box::new(update.config))
});
let mut subscriptions = vec![events, config_subscription, comp_config_subscription];
if let Some(conn) = self.conn.clone() {

View file

@ -34,18 +34,18 @@ pub fn create_memfile() -> rustix::io::Result<OwnedFd> {
time.duration_since(UNIX_EPOCH).unwrap().subsec_nanos()
);
match rustix::shm::shm_open(&name, flags, 0600.into()) {
match rustix::shm::shm_open(&name, flags, 0o600.into()) {
Ok(fd) => match rustix::shm::shm_unlink(&name) {
Ok(_) => return Ok(fd),
Err(errno) => {
return Err(errno.into());
return Err(errno);
}
},
#[allow(unreachable_patterns)]
Err(Errno::EXIST | Errno::EXIST) => {
continue;
}
Err(err) => return Err(err.into()),
Err(errno) => return Err(errno),
}
}
}

View file

@ -222,7 +222,7 @@ pub(crate) fn toplevel_preview(toplevel: &Toplevel) -> cosmic::Element<Msg> {
.padding(4);
crate::widgets::workspace_item(
vec![
close_button(Msg::CloseToplevel(toplevel.handle.clone())).into(),
close_button(Msg::CloseToplevel(toplevel.handle.clone())),
widget::button(capture_image(toplevel.img.as_ref()))
.selected(
toplevel

View file

@ -40,7 +40,7 @@ impl AxisExt for Axis {
}
}
pub fn toplevels<'a, Msg>(children: Vec<cosmic::Element<'a, Msg>>) -> Toplevels<'a, Msg> {
pub fn toplevels<Msg>(children: Vec<cosmic::Element<Msg>>) -> Toplevels<Msg> {
Toplevels {
axis: Axis::Horizontal,
children,

View file

@ -43,10 +43,7 @@ impl AxisExt for Axis {
}
}
pub fn workspace_bar<'a, Msg>(
children: Vec<cosmic::Element<'a, Msg>>,
axis: Axis,
) -> WorkspaceBar<'a, Msg> {
pub fn workspace_bar<Msg>(children: Vec<cosmic::Element<Msg>>, axis: Axis) -> WorkspaceBar<Msg> {
WorkspaceBar {
axis,
children,

View file

@ -45,10 +45,7 @@ impl AxisExt for Axis {
}
}
pub fn workspace_item<'a, Msg>(
children: Vec<cosmic::Element<'a, Msg>>,
axis: Axis,
) -> WorkspaceItem<'a, Msg> {
pub fn workspace_item<Msg>(children: Vec<cosmic::Element<Msg>>, axis: Axis) -> WorkspaceItem<Msg> {
WorkspaceItem {
axis,
children,