summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPhilipp Gesang <phg@phi-gamma.net>2021-12-22 17:29:52 +0100
committerPhilipp Gesang <phg@phi-gamma.net>2021-12-22 17:29:57 +0100
commit3bb3213576933dc1f43f5ed6f933cc7a8030014b (patch)
tree0effeb6f72c766ec6d6efae4ac105b976fe6adb8 /src
parentf87a4df1bc8d1b4be67046ab5672bb866737081f (diff)
downloadvtcol-3bb3213576933dc1f43f5ed6f933cc7a8030014b.tar.gz
bin: lib: address some clippy lints
Mostly about match autoref / autoderef kicking in.
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs8
-rw-r--r--src/vtcol.rs6
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<Console>
{
- 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)),