Skip to content

Commit

Permalink
2024: improve cargo workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
mirsella committed Dec 6, 2024
1 parent 7332c65 commit e2b338f
Show file tree
Hide file tree
Showing 15 changed files with 19 additions and 211 deletions.
35 changes: 8 additions & 27 deletions 2024/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,29 +1,10 @@
[workspace]
resolver = "2"
members = [
"day1",
"day2",
"day3",
"day4",
"day5",
"day6",
# "day7",
# "day8",
# "day9",
# "day10",
# "day11",
# "day12",
# "day13",
# "day14",
# "day15",
# "day16",
# "day17",
# "day18",
# "day19",
# "day20",
# "day21",
# "day22",
# "day23",
# "day24",
# "day25",
]
members = ["day*"]

[workspace.dependencies]
itertools = "0.13.0"
pathfinding = "4.11.0"
rayon = "1.10.0"
regex = "1.10.2"
indexmap = { version = "2.7.0", features = ["rayon"] }
3 changes: 1 addition & 2 deletions 2024/day1/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
itertools = "0.13.0"

itertools = { workspace = true }
28 changes: 0 additions & 28 deletions 2024/day1/build.rs

This file was deleted.

3 changes: 1 addition & 2 deletions 2024/day2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
itertools = "0.13.0"

itertools = { workspace = true }
28 changes: 0 additions & 28 deletions 2024/day2/build.rs

This file was deleted.

5 changes: 2 additions & 3 deletions 2024/day3/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
itertools = "0.13.0"
regex = "1.11.1"

itertools = { workspace = true }
regex = { workspace = true }
28 changes: 0 additions & 28 deletions 2024/day3/build.rs

This file was deleted.

5 changes: 2 additions & 3 deletions 2024/day4/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
itertools = "0.13.0"
pathfinding = "4.11.0"

itertools = { workspace = true }
pathfinding = { workspace = true }
28 changes: 0 additions & 28 deletions 2024/day4/build.rs

This file was deleted.

1 change: 0 additions & 1 deletion 2024/day4/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use itertools::Itertools;
use pathfinding::matrix::{directions::*, Matrix};
use std::collections::HashSet;
use std::iter;
Expand Down
3 changes: 1 addition & 2 deletions 2024/day5/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
itertools = "0.13.0"

itertools = { workspace = true }
28 changes: 0 additions & 28 deletions 2024/day5/build.rs

This file was deleted.

6 changes: 3 additions & 3 deletions 2024/day6/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
itertools = "0.13.0"
pathfinding = "4.11.0"
rayon = "1.10.0"
itertools = { workspace = true }
pathfinding = { workspace = true }
rayon = { workspace = true }
28 changes: 0 additions & 28 deletions 2024/day6/build.rs

This file was deleted.

1 change: 1 addition & 0 deletions 2024/day6/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ fn part2_clever(input: &str) -> usize {
}

// bruteforce but thanks to rayon its still really fast
// it can be much simpler, but i wanted to be able to visually debug the matrix if needed, so i modify the code directly
fn part2(input: &str) -> usize {
let directions = [(N, '^'), (E, '>'), (S, 'v'), (W, '<')];
let get_direction = |char: char| directions.iter().find(|(_, c)| char == *c).unwrap().0;
Expand Down

0 comments on commit e2b338f

Please sign in to comment.