Skip to content

Commit

Permalink
all: address clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
mahkoh committed Dec 7, 2024
1 parent 558fe3d commit e2f3164
Show file tree
Hide file tree
Showing 19 changed files with 25 additions and 26 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ ahash = "0.8.7"
log = { version = "0.4.20", features = ["std"] }
futures-util = "0.3.30"
num-traits = "0.2.17"
num-derive = "0.4.1"
num-derive = "0.4.2"
libloading = "0.8.1"
bstr = { version = "1.9.0", default-features = false, features = ["std"] }
isnt = "0.1.0"
Expand Down
2 changes: 1 addition & 1 deletion build/egl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ fn write_egl_procs<W: Write>(f: &mut W) -> anyhow::Result<()> {
for (name, _, _) in map.iter().copied() {
writeln!(
f,
" {}: unsafe {{ (egl.eglGetProcAddress)(\"{}\\0\".as_ptr() as _) }},",
" {}: unsafe {{ (egl.eglGetProcAddress)(c\"{}\".as_ptr() as _) }},",
name, name
)?;
}
Expand Down
1 change: 0 additions & 1 deletion src/cpu_worker/jobs/img_copy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use {
std::ptr,
};

#[expect(clippy::manual_non_exhaustive)]
pub struct ImgCopyWork {
pub src: *mut u8,
pub dst: *mut u8,
Expand Down
2 changes: 1 addition & 1 deletion src/udev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ impl Udev {
}

pub fn create_monitor(self: &Rc<Self>) -> Result<UdevMonitor, UdevError> {
let res = unsafe { udev_monitor_new_from_netlink(self.udev, "udev\0".as_ptr() as _) };
let res = unsafe { udev_monitor_new_from_netlink(self.udev, c"udev".as_ptr() as _) };
if res.is_null() {
return Err(UdevError::NewMonitor(Errno::default().into()));
}
Expand Down
2 changes: 1 addition & 1 deletion toml-config/src/config/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl<'a> Context<'a> {
}
}

impl<'a> ErrorHandler for Context<'a> {
impl ErrorHandler for Context<'_> {
fn handle(&self, err: Spanned<ParserError>) {
log::warn!("{}", Report::new(self.error(err)));
}
Expand Down
4 changes: 2 additions & 2 deletions toml-config/src/config/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub struct SpannedError<'a, E> {
pub cause: Option<E>,
}

impl<'a, E: Error> Display for SpannedError<'a, E> {
impl<E: Error> Display for SpannedError<'_, E> {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
let original = self.input.deref();
let span = self.span;
Expand Down Expand Up @@ -57,7 +57,7 @@ impl<'a, E: Error> Display for SpannedError<'a, E> {
}
}

impl<'a, E: Error> Error for SpannedError<'a, E> {}
impl<E: Error> Error for SpannedError<'_, E> {}

fn translate_position(input: &[u8], index: usize) -> (usize, usize) {
if input.is_empty() {
Expand Down
2 changes: 1 addition & 1 deletion toml-config/src/config/extractor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl<'v> Extractor<'v> {
}
}

impl<'v> Drop for Extractor<'v> {
impl Drop for Extractor<'_> {
fn drop(&mut self) {
if !self.log_unused {
return;
Expand Down
2 changes: 1 addition & 1 deletion toml-config/src/config/parsers/action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ impl ActionParser<'_> {
}
}

impl<'a> Parser for ActionParser<'a> {
impl Parser for ActionParser<'_> {
type Value = Action;
type Error = ActionParserError;
const EXPECTED: &'static [DataType] = &[DataType::String, DataType::Array, DataType::Table];
Expand Down
4 changes: 2 additions & 2 deletions toml-config/src/config/parsers/connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub enum ConnectorParserError {

pub struct ConnectorParser<'a>(pub &'a Context<'a>);

impl<'a> Parser for ConnectorParser<'a> {
impl Parser for ConnectorParser<'_> {
type Value = ConfigConnector;
type Error = ConnectorParserError;
const EXPECTED: &'static [DataType] = &[DataType::Table];
Expand All @@ -49,7 +49,7 @@ impl<'a> Parser for ConnectorParser<'a> {

pub struct ConnectorsParser<'a>(pub &'a Context<'a>);

impl<'a> Parser for ConnectorsParser<'a> {
impl Parser for ConnectorsParser<'_> {
type Value = Vec<ConfigConnector>;
type Error = ConnectorParserError;
const EXPECTED: &'static [DataType] = &[DataType::Table, DataType::Array];
Expand Down
2 changes: 1 addition & 1 deletion toml-config/src/config/parsers/connector_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub enum ConnectorMatchParserError {

pub struct ConnectorMatchParser<'a>(pub &'a Context<'a>);

impl<'a> Parser for ConnectorMatchParser<'a> {
impl Parser for ConnectorMatchParser<'_> {
type Value = ConnectorMatch;
type Error = ConnectorMatchParserError;
const EXPECTED: &'static [DataType] = &[DataType::Table, DataType::Array];
Expand Down
4 changes: 2 additions & 2 deletions toml-config/src/config/parsers/drm_device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub struct DrmDeviceParser<'a> {
pub name_ok: bool,
}

impl<'a> Parser for DrmDeviceParser<'a> {
impl Parser for DrmDeviceParser<'_> {
type Value = ConfigDrmDevice;
type Error = DrmDeviceParserError;
const EXPECTED: &'static [DataType] = &[DataType::Table];
Expand Down Expand Up @@ -89,7 +89,7 @@ impl<'a> Parser for DrmDeviceParser<'a> {

pub struct DrmDevicesParser<'a>(pub &'a Context<'a>);

impl<'a> Parser for DrmDevicesParser<'a> {
impl Parser for DrmDevicesParser<'_> {
type Value = Vec<ConfigDrmDevice>;
type Error = DrmDeviceParserError;
const EXPECTED: &'static [DataType] = &[DataType::Table, DataType::Array];
Expand Down
4 changes: 2 additions & 2 deletions toml-config/src/config/parsers/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pub struct InputParser<'a> {
pub is_inputs_array: bool,
}

impl<'a> Parser for InputParser<'a> {
impl Parser for InputParser<'_> {
type Value = Input;
type Error = InputParserError;
const EXPECTED: &'static [DataType] = &[DataType::Table];
Expand Down Expand Up @@ -254,7 +254,7 @@ impl<'a> Parser for InputParser<'a> {

pub struct InputsParser<'a>(pub &'a Context<'a>);

impl<'a> Parser for InputsParser<'a> {
impl Parser for InputsParser<'_> {
type Value = Vec<Input>;
type Error = InputParserError;
const EXPECTED: &'static [DataType] = &[DataType::Table, DataType::Array];
Expand Down
2 changes: 1 addition & 1 deletion toml-config/src/config/parsers/input_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub enum InputMatchParserError {

pub struct InputMatchParser<'a>(pub &'a Context<'a>);

impl<'a> Parser for InputMatchParser<'a> {
impl Parser for InputMatchParser<'_> {
type Value = InputMatch;
type Error = InputMatchParserError;
const EXPECTED: &'static [DataType] = &[DataType::Table, DataType::Array];
Expand Down
2 changes: 1 addition & 1 deletion toml-config/src/config/parsers/mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub enum ModeParserError {

pub struct ModeParser<'a>(pub &'a Context<'a>);

impl<'a> Parser for ModeParser<'a> {
impl Parser for ModeParser<'_> {
type Value = Mode;
type Error = ModeParserError;
const EXPECTED: &'static [DataType] = &[DataType::Table];
Expand Down
4 changes: 2 additions & 2 deletions toml-config/src/config/parsers/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub struct OutputParser<'a> {
pub name_ok: bool,
}

impl<'a> Parser for OutputParser<'a> {
impl Parser for OutputParser<'_> {
type Value = Output;
type Error = OutputParserError;
const EXPECTED: &'static [DataType] = &[DataType::Table];
Expand Down Expand Up @@ -150,7 +150,7 @@ impl<'a> Parser for OutputParser<'a> {

pub struct OutputsParser<'a>(pub &'a Context<'a>);

impl<'a> Parser for OutputsParser<'a> {
impl Parser for OutputsParser<'_> {
type Value = Vec<Output>;
type Error = OutputParserError;
const EXPECTED: &'static [DataType] = &[DataType::Table, DataType::Array];
Expand Down
2 changes: 1 addition & 1 deletion toml-config/src/config/parsers/output_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub enum OutputMatchParserError {

pub struct OutputMatchParser<'a>(pub &'a Context<'a>);

impl<'a> Parser for OutputMatchParser<'a> {
impl Parser for OutputMatchParser<'_> {
type Value = OutputMatch;
type Error = OutputMatchParserError;
const EXPECTED: &'static [DataType] = &[DataType::Table, DataType::Table];
Expand Down
2 changes: 1 addition & 1 deletion toml-config/src/toml/toml_lexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub enum Token<'a> {
Literal(&'a [u8]),
}

impl<'a> Token<'a> {
impl Token<'_> {
pub fn name(self, value_context: bool) -> &'static str {
match self {
Token::Dot => "`.`",
Expand Down
2 changes: 1 addition & 1 deletion toml-config/src/toml/toml_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ struct Parser<'a, 'b> {

type Key = VecDeque<Spanned<String>>;

impl<'a, 'b> Parser<'a, 'b> {
impl<'a> Parser<'a, '_> {
fn parse(mut self) -> Result<Spanned<Value>, Spanned<ParserError>> {
self.parse_document()
}
Expand Down

0 comments on commit e2f3164

Please sign in to comment.