From ae66622c10febf67da03e4bc7fc31b88be37bd3b Mon Sep 17 00:00:00 2001 From: Samuel Tardieu Date: Sun, 31 Dec 2023 10:27:01 +0100 Subject: [PATCH] style: fix clippy warnings --- aoc/src/input.rs | 4 ++-- aoc/src/run.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/aoc/src/input.rs b/aoc/src/input.rs index 0cbcd91..f6c2c8c 100644 --- a/aoc/src/input.rs +++ b/aoc/src/input.rs @@ -6,7 +6,7 @@ use std::str::FromStr; pub static mut OVERRIDE_INPUT: Option = None; pub fn input_bytes(day: usize) -> Result, Error> { - match { unsafe { &OVERRIDE_INPUT } } { + match unsafe { &OVERRIDE_INPUT } { Some(s) => Ok(std::fs::read(s).unwrap_or_else(|_| { let mut s = s.as_bytes().to_vec(); s.push(b'\n'); @@ -20,7 +20,7 @@ pub fn input_string(day: usize) -> Result { Ok(String::from_utf8(input_bytes(day)?)?) } -/// Parse input as lines() if `sep` is absent, or as a single line +/// Parse input as `lines()` if `sep` is absent, or as a single line /// if `sep` is present. pub fn parse_input(input: &str, sep: Option<&str>) -> Result, Error> where diff --git a/aoc/src/run.rs b/aoc/src/run.rs index 2d1a0e6..13febe2 100644 --- a/aoc/src/run.rs +++ b/aoc/src/run.rs @@ -107,7 +107,7 @@ where if opts.input.is_some() && opts.all { eyre::bail!("--all and --input are not compatible"); } - if opts.part.is_some_and(|p| p < 1 || p > 2) { + if opts.part.is_some_and(|p| !(1..=2).contains(&p)) { eyre::bail!("--part accepts argument must be 1 or 2"); } unsafe {