From 3bb3213576933dc1f43f5ed6f933cc7a8030014b Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Wed, 22 Dec 2021 17:29:52 +0100 Subject: bin: lib: address some clippy lints Mostly about match autoref / autoderef kicking in. --- src/lib.rs | 8 +++++--- src/vtcol.rs | 6 ++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index aee486d..5cf62c1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,5 @@ +#![allow(clippy::new_without_default)] + use std::{convert::TryFrom, fmt, io::{self, BufWriter, Error, Write}, @@ -72,7 +74,7 @@ pub mod ioctl ioctl( fd.as_raw_fd(), PIO_CMAP, - std::mem::transmute::<&Palette, *const libc::c_void>(&pal), + std::mem::transmute::<&Palette, *const libc::c_void>(pal), ) } }) @@ -1018,7 +1020,7 @@ impl Palette } let mut res = Self::new(); - res.0.copy_from_slice(&b); + res.0.copy_from_slice(b); Ok(res) } @@ -1164,7 +1166,7 @@ impl Console Err(io::Error::new( io::ErrorKind::Other, - format!("could not retrieve fd for any of the search paths"), + String::from("could not retrieve fd for any of the search paths"), )) } diff --git a/src/vtcol.rs b/src/vtcol.rs index 183da18..93cece2 100644 --- a/src/vtcol.rs +++ b/src/vtcol.rs @@ -1,3 +1,5 @@ +#![allow(clippy::option_map_unit_fn)] + pub mod lib; use vtcol::{Console, Fade, KbLedFlags, KbLedState, Palette, Scheme}; @@ -23,7 +25,7 @@ none is explicitly supplied. */ #[inline] fn open_console(path: Option<&str>) -> io::Result { - path.map(Console::from_path).unwrap_or_else(|| Console::current()) + path.map(Console::from_path).unwrap_or_else(Console::current) } /** Trait for subcommands to implement. */ @@ -767,7 +769,7 @@ impl<'a> Job Ok(Self(con, Subcmd::Colors(ColorJob::List))), ("set", Some(subm)) => { if let Some(b64) = subm.value_of("base64") { - let scheme = Scheme::from_base64(&b64)?; + let scheme = Scheme::from_base64(b64)?; return Ok(Self( con, Subcmd::Colors(ColorJob::Set(scheme)), -- cgit v1.2.3