Skip to content

Commit

Permalink
Merge pull request #65 from evenfurther/clippy
Browse files Browse the repository at this point in the history
style: fix clippy warnings
  • Loading branch information
samueltardieu authored Dec 31, 2023
2 parents dc17d6b + ae66622 commit f1dfb71
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions aoc/src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::str::FromStr;
pub static mut OVERRIDE_INPUT: Option<String> = None;

pub fn input_bytes(day: usize) -> Result<Vec<u8>, 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');
Expand All @@ -20,7 +20,7 @@ pub fn input_string(day: usize) -> Result<String, Error> {
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<T>(input: &str, sep: Option<&str>) -> Result<Vec<T>, Error>
where
Expand Down
2 changes: 1 addition & 1 deletion aoc/src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit f1dfb71

Please sign in to comment.