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

View file

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

View file

@ -31,20 +31,15 @@ use {
thiserror::Error,
};
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Default)]
pub enum XInputModel {
None,
#[default]
Passive,
Local,
Global,
}
impl Default for XInputModel {
fn default() -> Self {
Self::Passive
}
}
#[derive(Default, Debug)]
pub struct IcccmHints {
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 {
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::needless_return,
clippy::missing_safety_doc,
clippy::collapsible_if,
clippy::mut_from_ref,
clippy::bool_comparison,
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 {
#[default]
Add,
Sub,
}
impl Default for BuilderOp {
fn default() -> Self {
Self::Add
}
}
#[derive(Debug)]
pub struct RegionBuilder {
base: Rc<Region>,

View file

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