Solve some warnings

This commit is contained in:
JonOfUs 2024-12-06 15:30:11 +01:00
parent 686ec4ed0e
commit 03fd24f930
4 changed files with 6 additions and 10 deletions

View file

@ -44,15 +44,15 @@ pub fn solve() {
let result = reports
.iter()
.filter(|r| {
if safe(r.clone().to_vec(), false) {
if safe((*r).clone().to_vec(), false) {
return true;
}
let mut r2 = r.clone().to_vec();
let mut r2 = (*r).clone().to_vec();
r2.remove(0);
if safe(r2, true) {
return true;
}
let mut r3 = r.clone().to_vec();
let mut r3 = (*r).clone().to_vec();
r3.remove(1);
safe(r3, true)
})

View file

@ -6,7 +6,6 @@ pub fn solve() {
let contents = fs::read_to_string(path).expect("Something went wrong reading the file");
let re = Regex::new(r"mul\((\d{1,3}),(\d{1,3})\)").unwrap();
let mults = get_mults(contents.as_str());
let result = mults.iter().map(|(a, b)| a * b).sum::<usize>();

View file

@ -3,9 +3,7 @@ use std::{
fs,
};
use rayon::iter::{
IndexedParallelIterator, IntoParallelRefIterator, ParallelBridge, ParallelIterator,
};
use rayon::iter::{ParallelBridge, ParallelIterator};
pub fn solve() {
let path = "res/06/input";
@ -67,8 +65,6 @@ pub fn solve() {
let result: usize = guard_positions.len();
println!("Result 1: {}", result);
let mut obstacle_positions: HashSet<(isize, isize)> = HashSet::new();
let obstacle_positions: Vec<Vec<(isize, isize)>> = map
.iter()
.enumerate()
@ -76,6 +72,7 @@ pub fn solve() {
.map(|(i, row)| {
row.iter()
.enumerate()
.par_bridge()
.filter(|(j, cell)| {
if !*cell && (i as isize, *j as isize) != init_pos {
let mut new_map = map.clone();

View file

@ -4,7 +4,7 @@ extern crate scan_fmt;
use std::time::Instant;
fn main() {
//days::d03::solve()
//days::d06::solve()
_all_days()
}