summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Oram <dev@mitmaro.ca>2020-11-19 21:45:07 -0330
committerTim Oram <dev@mitmaro.ca>2020-11-19 21:56:04 -0330
commitfd5c0ab03cf541cd97f9aec06cf792a3c3123d36 (patch)
tree311ec3b46ae3784b22425d94ff4db0a6be4e85eb
parentc749c31cde54160f7138b098ac78212b1dc63048 (diff)
Fix latest Clippy errors
The latest update to Clippy caused a few new errors, this fixes those new errors.
-rw-r--r--src/config/utils.rs1
-rw-r--r--src/display/color.rs2
-rw-r--r--src/display/color_mode.rs5
-rw-r--r--src/display/mod.rs1
4 files changed, 3 insertions, 6 deletions
diff --git a/src/config/utils.rs b/src/config/utils.rs
index 3909c2c..be65565 100644
--- a/src/config/utils.rs
+++ b/src/config/utils.rs
@@ -74,6 +74,7 @@ pub(super) fn get_bool(config: &Config, name: &str, default: bool) -> Result<boo
.map_err(|e| e.context(anyhow!("\"{}\" is not valid", name)))
}
+#[allow(clippy::map_err_ignore)]
pub(super) fn get_unsigned_integer(config: &Config, name: &str, default: u32) -> Result<u32> {
match config.get_i32(name) {
Ok(v) => {
diff --git a/src/display/color.rs b/src/display/color.rs
index 270abe3..85c972b 100644
--- a/src/display/color.rs
+++ b/src/display/color.rs
@@ -53,7 +53,7 @@ impl TryFrom<&str> for Color {
1 => {
let color_index = s.parse::<i16>();
match color_index {
- Ok(i) if i >= 0 && i < 256 => Ok(Self::Index(i)),
+ Ok(i) if (0..256).contains(&i) => Ok(Self::Index(i)),
_ => {
Err(anyhow!(
"\"{}\" is not a valid color index. Index must be between 0-255.",
diff --git a/src/display/color_mode.rs b/src/display/color_mode.rs
index a1f1cf9..42511b8 100644
--- a/src/display/color_mode.rs
+++ b/src/display/color_mode.rs
@@ -71,9 +71,4 @@ mod tests {
fn color_mode_has_true_color_true_color() {
assert!(ColorMode::TrueColor.has_true_color());
}
-
- #[test]
- fn color_mode_equals_other_color_mode() {
- assert_eq!(ColorMode::TrueColor, ColorMode::TrueColor);
- }
}
diff --git a/src/display/mod.rs b/src/display/mod.rs
index 2d2267d..8ee0c47 100644
--- a/src/display/mod.rs
+++ b/src/display/mod.rs
@@ -246,6 +246,7 @@ impl<'d> Display<'d> {
}
}
+ #[allow(clippy::unwrap_in_result)]
pub(crate) fn getch(&self) -> Option<Input> {
let input = self.curses.getch();