feat: update to rust edition 2024
This commit is contained in:
4
Cargo.lock
generated
4
Cargo.lock
generated
@@ -1,6 +1,6 @@
|
|||||||
# This file is automatically @generated by Cargo.
|
# This file is automatically @generated by Cargo.
|
||||||
# It is not intended for manual editing.
|
# It is not intended for manual editing.
|
||||||
version = 3
|
version = 4
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "addr2line"
|
name = "addr2line"
|
||||||
@@ -19,7 +19,7 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "advent_of_code"
|
name = "advent_of_code"
|
||||||
version = "0.11.0"
|
version = "0.12.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"dhat",
|
"dhat",
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "advent_of_code"
|
name = "advent_of_code"
|
||||||
version = "0.11.0"
|
version = "0.12.0"
|
||||||
authors = ["Felix Spöttel <1682504+fspoettel@users.noreply.github.com>"]
|
authors = ["Felix Spöttel <1682504+fspoettel@users.noreply.github.com>"]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
default-run = "advent_of_code"
|
default-run = "advent_of_code"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
use crate::template::{aoc_cli, Day};
|
use crate::template::{Day, aoc_cli};
|
||||||
use std::process;
|
use std::process;
|
||||||
|
|
||||||
pub fn handle(day: Day) {
|
pub fn handle(day: Day) {
|
||||||
if aoc_cli::check().is_err() {
|
if aoc_cli::check().is_err() {
|
||||||
eprintln!("command \"aoc\" not found or not callable. Try running \"cargo install aoc-cli\" to install it.");
|
eprintln!(
|
||||||
|
"command \"aoc\" not found or not callable. Try running \"cargo install aoc-cli\" to install it."
|
||||||
|
);
|
||||||
process::exit(1);
|
process::exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
use std::process;
|
use std::process;
|
||||||
|
|
||||||
use crate::template::{aoc_cli, Day};
|
use crate::template::{Day, aoc_cli};
|
||||||
|
|
||||||
pub fn handle(day: Day) {
|
pub fn handle(day: Day) {
|
||||||
if aoc_cli::check().is_err() {
|
if aoc_cli::check().is_err() {
|
||||||
eprintln!("command \"aoc\" not found or not callable. Try running \"cargo install aoc-cli\" to install it.");
|
eprintln!(
|
||||||
|
"command \"aoc\" not found or not callable. Try running \"cargo install aoc-cli\" to install it."
|
||||||
|
);
|
||||||
process::exit(1);
|
process::exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ use std::collections::HashSet;
|
|||||||
|
|
||||||
use crate::template::run_multi::run_multi;
|
use crate::template::run_multi::run_multi;
|
||||||
use crate::template::timings::Timings;
|
use crate::template::timings::Timings;
|
||||||
use crate::template::{all_days, readme_benchmarks, Day};
|
use crate::template::{Day, all_days, readme_benchmarks};
|
||||||
|
|
||||||
pub fn handle(day: Option<Day>, run_all: bool, store: bool) {
|
pub fn handle(day: Option<Day>, run_all: bool, store: bool) {
|
||||||
let stored_timings = Timings::read_from_file();
|
let stored_timings = Timings::read_from_file();
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ macro_rules! day {
|
|||||||
|
|
||||||
#[cfg(feature = "test_lib")]
|
#[cfg(feature = "test_lib")]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{all_days, Day};
|
use super::{Day, all_days};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn all_days_iterator() {
|
fn all_days_iterator() {
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
/// The approach taken is similar to how `aoc-readme-stars` handles this.
|
/// The approach taken is similar to how `aoc-readme-stars` handles this.
|
||||||
use std::{fs, io};
|
use std::{fs, io};
|
||||||
|
|
||||||
use crate::template::timings::Timings;
|
|
||||||
use crate::template::Day;
|
use crate::template::Day;
|
||||||
|
use crate::template::timings::Timings;
|
||||||
|
|
||||||
static MARKER: &str = "<!--- benchmarking table --->";
|
static MARKER: &str = "<!--- benchmarking table --->";
|
||||||
|
|
||||||
@@ -99,7 +99,7 @@ pub fn update(timings: Timings) -> Result<(), Error> {
|
|||||||
|
|
||||||
#[cfg(feature = "test_lib")]
|
#[cfg(feature = "test_lib")]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{update_content, MARKER};
|
use super::{MARKER, update_content};
|
||||||
use crate::{day, template::timings::Timing, template::timings::Timings};
|
use crate::{day, template::timings::Timing, template::timings::Timings};
|
||||||
|
|
||||||
fn get_mock_timings() -> Timings {
|
fn get_mock_timings() -> Timings {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use std::{collections::HashSet, io};
|
use std::{collections::HashSet, io};
|
||||||
|
|
||||||
use crate::template::{Day, ANSI_BOLD, ANSI_ITALIC, ANSI_RESET};
|
use crate::template::{ANSI_BOLD, ANSI_ITALIC, ANSI_RESET, Day};
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
all_days,
|
all_days,
|
||||||
@@ -67,7 +67,7 @@ pub fn get_path_for_bin(day: Day) -> String {
|
|||||||
/// All solutions live in isolated binaries.
|
/// All solutions live in isolated binaries.
|
||||||
/// This module encapsulates interaction with these binaries, both invoking them as well as parsing the timing output.
|
/// This module encapsulates interaction with these binaries, both invoking them as well as parsing the timing output.
|
||||||
pub mod child_commands {
|
pub mod child_commands {
|
||||||
use super::{get_path_for_bin, Error};
|
use super::{Error, get_path_for_bin};
|
||||||
use crate::template::Day;
|
use crate::template::Day;
|
||||||
use std::{
|
use std::{
|
||||||
io::{BufRead, BufReader},
|
io::{BufRead, BufReader},
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
/// Encapsulates code that interacts with solution functions.
|
/// Encapsulates code that interacts with solution functions.
|
||||||
use std::fmt::Display;
|
use std::fmt::Display;
|
||||||
use std::hint::black_box;
|
use std::hint::black_box;
|
||||||
use std::io::{stdout, Write};
|
use std::io::{Write, stdout};
|
||||||
use std::process::Output;
|
use std::process::Output;
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
use std::{cmp, env, process};
|
use std::{cmp, env, process};
|
||||||
|
|
||||||
use crate::template::ANSI_BOLD;
|
use crate::template::ANSI_BOLD;
|
||||||
use crate::template::{aoc_cli, Day, ANSI_ITALIC, ANSI_RESET};
|
use crate::template::{ANSI_ITALIC, ANSI_RESET, Day, aoc_cli};
|
||||||
|
|
||||||
pub fn run_part<I: Copy, T: Display>(func: impl Fn(I) -> Option<T>, input: I, day: Day, part: u8) {
|
pub fn run_part<I: Copy, T: Display>(func: impl Fn(I) -> Option<T>, input: I, day: Day, part: u8) {
|
||||||
let part_str = format!("Part {part}");
|
let part_str = format!("Part {part}");
|
||||||
@@ -156,7 +156,9 @@ fn submit_result<T: Display>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if aoc_cli::check().is_err() {
|
if aoc_cli::check().is_err() {
|
||||||
eprintln!("command \"aoc\" not found or not callable. Try running \"cargo install aoc-cli\" to install it.");
|
eprintln!(
|
||||||
|
"command \"aoc\" not found or not callable. Try running \"cargo install aoc-cli\" to install it."
|
||||||
|
);
|
||||||
process::exit(1);
|
process::exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user