1
0
Fork 0
forked from wry/wry

Merge pull request #669 from mahkoh/jorth/clippy-5

all: address clippy lints
This commit is contained in:
mahkoh 2025-11-28 13:36:06 +01:00 committed by GitHub
commit da74f61bea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 10 additions and 31 deletions

View file

@ -191,10 +191,11 @@ pub enum CliBackend {
Metal, Metal,
} }
#[derive(ValueEnum, Debug, Copy, Clone, Hash)] #[derive(ValueEnum, Debug, Copy, Clone, Hash, Default)]
pub enum CliLogLevel { pub enum CliLogLevel {
Trace, Trace,
Debug, Debug,
#[default]
Info, Info,
Warn, Warn,
Error, Error,
@ -212,12 +213,6 @@ impl Into<Level> for CliLogLevel {
} }
} }
impl Default for CliLogLevel {
fn default() -> Self {
Self::Info
}
}
#[derive(Args, Debug)] #[derive(Args, Debug)]
pub struct GenerateArgs { pub struct GenerateArgs {
/// The shell to generate completions for /// The shell to generate completions for

View file

@ -9,9 +9,10 @@ use {
std::{cell::Cell, rc::Rc}, std::{cell::Cell, rc::Rc},
}; };
#[derive(Subcommand, Debug)] #[derive(Subcommand, Debug, Default)]
pub enum IdleCmd { pub enum IdleCmd {
/// Print the idle status. /// Print the idle status.
#[default]
Status, Status,
/// Set the idle interval. /// Set the idle interval.
Set(IdleSetArgs), Set(IdleSetArgs),
@ -19,12 +20,6 @@ pub enum IdleCmd {
SetGracePeriod(IdleSetGracePeriodArgs), SetGracePeriod(IdleSetGracePeriodArgs),
} }
impl Default for IdleCmd {
fn default() -> Self {
Self::Status
}
}
#[derive(Args, Debug)] #[derive(Args, Debug)]
pub struct IdleSetArgs { pub struct IdleSetArgs {
/// The interval of inactivity after which to disable the screens. /// The interval of inactivity after which to disable the screens.

View file

@ -31,20 +31,15 @@ use {
thiserror::Error, thiserror::Error,
}; };
#[derive(Copy, Clone, Debug, Eq, PartialEq)] #[derive(Copy, Clone, Debug, Eq, PartialEq, Default)]
pub enum XInputModel { pub enum XInputModel {
None, None,
#[default]
Passive, Passive,
Local, Local,
Global, Global,
} }
impl Default for XInputModel {
fn default() -> Self {
Self::Passive
}
}
#[derive(Default, Debug)] #[derive(Default, Debug)]
pub struct IcccmHints { pub struct IcccmHints {
pub flags: Cell<i32>, pub flags: Cell<i32>,

View file

@ -61,7 +61,7 @@ fn map(fd: c::c_int, size: usize) -> Result<*const [Cell<u8>], TestError> {
if res == c::MAP_FAILED { if res == c::MAP_FAILED {
bail!("Could not map memory: {}", OsError::default()); bail!("Could not map memory: {}", OsError::default());
} }
Ok(std::slice::from_raw_parts(res as _, size)) Ok(ptr::slice_from_raw_parts(res as _, size))
} }
} }

View file

@ -24,7 +24,6 @@
clippy::unnecessary_unwrap, clippy::unnecessary_unwrap,
clippy::needless_return, clippy::needless_return,
clippy::missing_safety_doc, clippy::missing_safety_doc,
clippy::collapsible_if,
clippy::mut_from_ref, clippy::mut_from_ref,
clippy::bool_comparison, clippy::bool_comparison,
clippy::collapsible_match, clippy::collapsible_match,

View file

@ -234,18 +234,13 @@ where
} }
} }
#[derive(Copy, Clone, Eq, PartialEq, Debug)] #[derive(Copy, Clone, Eq, PartialEq, Debug, Default)]
enum BuilderOp { enum BuilderOp {
#[default]
Add, Add,
Sub, Sub,
} }
impl Default for BuilderOp {
fn default() -> Self {
Self::Add
}
}
#[derive(Debug)] #[derive(Debug)]
pub struct RegionBuilder { pub struct RegionBuilder {
base: Rc<Region>, base: Rc<Region>,

View file

@ -20,7 +20,7 @@ pub fn mmap(
Err(OsError::default()) Err(OsError::default())
} else { } else {
Ok(Mmapped { Ok(Mmapped {
ptr: unsafe { std::slice::from_raw_parts(res.cast(), len) }, ptr: ptr::slice_from_raw_parts(res.cast(), len),
}) })
} }
} }