feat: move .trim inside read function

This commit is contained in:
2023-11-18 20:08:29 +01:00
parent 00000270a3
commit 000002809a
4 changed files with 5 additions and 6 deletions

View File

@@ -24,12 +24,12 @@ mod tests {
use super::*;
#[test]
fn test_part_one() {
let input = aoc::read_file("examples", DAY).trim();
let input = aoc::read_file("examples", DAY);
assert_eq!(part_one(&input), None);
}
#[test]
fn test_part_two() {
let input = aoc::read_file("examples", DAY).trim();
let input = aoc::read_file("examples", DAY);
assert_eq!(part_two(&input), None);
}
}

View File

@@ -45,11 +45,10 @@ pub fn read_file(folder: &str, day: u8) -> String {
let filepath = cwd.join("src").join(folder).join(format!("{day:02}.txt"));
let f = fs::read_to_string(filepath);
f.expect("could not open input file")
f.expect("could not open input file").trim().to_string()
}
pub fn parse_args() -> Result<u8, pico_args::Error> {
let mut args = pico_args::Arguments::from_env();
args.free_from_str()
}