Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: fix clippy warnings #65

Merged
merged 1 commit into from
Dec 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading