From e2f31646f2ea9107b035db4d2987ac53015aac28 Mon Sep 17 00:00:00 2001 From: Julian Orth Date: Sat, 7 Dec 2024 14:59:28 +0100 Subject: [PATCH] all: address clippy lints --- Cargo.lock | 6 +++--- Cargo.toml | 2 +- build/egl.rs | 2 +- src/cpu_worker/jobs/img_copy.rs | 1 - src/udev.rs | 2 +- toml-config/src/config/context.rs | 2 +- toml-config/src/config/error.rs | 4 ++-- toml-config/src/config/extractor.rs | 2 +- toml-config/src/config/parsers/action.rs | 2 +- toml-config/src/config/parsers/connector.rs | 4 ++-- toml-config/src/config/parsers/connector_match.rs | 2 +- toml-config/src/config/parsers/drm_device.rs | 4 ++-- toml-config/src/config/parsers/input.rs | 4 ++-- toml-config/src/config/parsers/input_match.rs | 2 +- toml-config/src/config/parsers/mode.rs | 2 +- toml-config/src/config/parsers/output.rs | 4 ++-- toml-config/src/config/parsers/output_match.rs | 2 +- toml-config/src/toml/toml_lexer.rs | 2 +- toml-config/src/toml/toml_parser.rs | 2 +- 19 files changed, 25 insertions(+), 26 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3b9e8feb..1507b657 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "addr2line" @@ -715,9 +715,9 @@ checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" [[package]] name = "num-derive" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfb77679af88f8b125209d354a202862602672222e7f2313fdd6dc349bad4712" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 12f4341d..3a69be90 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" diff --git a/build/egl.rs b/build/egl.rs index f2403e5b..d47388fb 100644 --- a/build/egl.rs +++ b/build/egl.rs @@ -131,7 +131,7 @@ fn write_egl_procs(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 )?; } diff --git a/src/cpu_worker/jobs/img_copy.rs b/src/cpu_worker/jobs/img_copy.rs index 6f7391c7..f50a7b25 100644 --- a/src/cpu_worker/jobs/img_copy.rs +++ b/src/cpu_worker/jobs/img_copy.rs @@ -6,7 +6,6 @@ use { std::ptr, }; -#[expect(clippy::manual_non_exhaustive)] pub struct ImgCopyWork { pub src: *mut u8, pub dst: *mut u8, diff --git a/src/udev.rs b/src/udev.rs index fe077a96..29c2746c 100644 --- a/src/udev.rs +++ b/src/udev.rs @@ -138,7 +138,7 @@ impl Udev { } pub fn create_monitor(self: &Rc) -> Result { - 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())); } diff --git a/toml-config/src/config/context.rs b/toml-config/src/config/context.rs index 704d36b3..8dd95d3d 100644 --- a/toml-config/src/config/context.rs +++ b/toml-config/src/config/context.rs @@ -50,7 +50,7 @@ impl<'a> Context<'a> { } } -impl<'a> ErrorHandler for Context<'a> { +impl ErrorHandler for Context<'_> { fn handle(&self, err: Spanned) { log::warn!("{}", Report::new(self.error(err))); } diff --git a/toml-config/src/config/error.rs b/toml-config/src/config/error.rs index b2679300..12102ddc 100644 --- a/toml-config/src/config/error.rs +++ b/toml-config/src/config/error.rs @@ -17,7 +17,7 @@ pub struct SpannedError<'a, E> { pub cause: Option, } -impl<'a, E: Error> Display for SpannedError<'a, E> { +impl Display for SpannedError<'_, E> { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { let original = self.input.deref(); let span = self.span; @@ -57,7 +57,7 @@ impl<'a, E: Error> Display for SpannedError<'a, E> { } } -impl<'a, E: Error> Error for SpannedError<'a, E> {} +impl Error for SpannedError<'_, E> {} fn translate_position(input: &[u8], index: usize) -> (usize, usize) { if input.is_empty() { diff --git a/toml-config/src/config/extractor.rs b/toml-config/src/config/extractor.rs index 90da0cc5..4744a10f 100644 --- a/toml-config/src/config/extractor.rs +++ b/toml-config/src/config/extractor.rs @@ -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; diff --git a/toml-config/src/config/parsers/action.rs b/toml-config/src/config/parsers/action.rs index 3f1ed639..8d985aa7 100644 --- a/toml-config/src/config/parsers/action.rs +++ b/toml-config/src/config/parsers/action.rs @@ -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]; diff --git a/toml-config/src/config/parsers/connector.rs b/toml-config/src/config/parsers/connector.rs index e4c6a2ae..b603b409 100644 --- a/toml-config/src/config/parsers/connector.rs +++ b/toml-config/src/config/parsers/connector.rs @@ -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]; @@ -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; type Error = ConnectorParserError; const EXPECTED: &'static [DataType] = &[DataType::Table, DataType::Array]; diff --git a/toml-config/src/config/parsers/connector_match.rs b/toml-config/src/config/parsers/connector_match.rs index f64178a0..3e7853a3 100644 --- a/toml-config/src/config/parsers/connector_match.rs +++ b/toml-config/src/config/parsers/connector_match.rs @@ -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]; diff --git a/toml-config/src/config/parsers/drm_device.rs b/toml-config/src/config/parsers/drm_device.rs index ddd0a66d..4b488dbe 100644 --- a/toml-config/src/config/parsers/drm_device.rs +++ b/toml-config/src/config/parsers/drm_device.rs @@ -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]; @@ -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; type Error = DrmDeviceParserError; const EXPECTED: &'static [DataType] = &[DataType::Table, DataType::Array]; diff --git a/toml-config/src/config/parsers/input.rs b/toml-config/src/config/parsers/input.rs index dbe78335..1660e933 100644 --- a/toml-config/src/config/parsers/input.rs +++ b/toml-config/src/config/parsers/input.rs @@ -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]; @@ -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; type Error = InputParserError; const EXPECTED: &'static [DataType] = &[DataType::Table, DataType::Array]; diff --git a/toml-config/src/config/parsers/input_match.rs b/toml-config/src/config/parsers/input_match.rs index 4f0e5b98..77953110 100644 --- a/toml-config/src/config/parsers/input_match.rs +++ b/toml-config/src/config/parsers/input_match.rs @@ -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]; diff --git a/toml-config/src/config/parsers/mode.rs b/toml-config/src/config/parsers/mode.rs index e8af6ba6..e84cb908 100644 --- a/toml-config/src/config/parsers/mode.rs +++ b/toml-config/src/config/parsers/mode.rs @@ -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]; diff --git a/toml-config/src/config/parsers/output.rs b/toml-config/src/config/parsers/output.rs index 4f14d7ae..83f15b12 100644 --- a/toml-config/src/config/parsers/output.rs +++ b/toml-config/src/config/parsers/output.rs @@ -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]; @@ -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; type Error = OutputParserError; const EXPECTED: &'static [DataType] = &[DataType::Table, DataType::Array]; diff --git a/toml-config/src/config/parsers/output_match.rs b/toml-config/src/config/parsers/output_match.rs index d24cce37..dedaad74 100644 --- a/toml-config/src/config/parsers/output_match.rs +++ b/toml-config/src/config/parsers/output_match.rs @@ -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]; diff --git a/toml-config/src/toml/toml_lexer.rs b/toml-config/src/toml/toml_lexer.rs index a227fc12..7e3d90b8 100644 --- a/toml-config/src/toml/toml_lexer.rs +++ b/toml-config/src/toml/toml_lexer.rs @@ -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 => "`.`", diff --git a/toml-config/src/toml/toml_parser.rs b/toml-config/src/toml/toml_parser.rs index 56178448..de10b811 100644 --- a/toml-config/src/toml/toml_parser.rs +++ b/toml-config/src/toml/toml_parser.rs @@ -58,7 +58,7 @@ struct Parser<'a, 'b> { type Key = VecDeque>; -impl<'a, 'b> Parser<'a, 'b> { +impl<'a> Parser<'a, '_> { fn parse(mut self) -> Result, Spanned> { self.parse_document() }