feat: update to rust edition 2024

This commit is contained in:
Felix Spöttel 2025-11-26 14:14:49 +01:00
parent b67460e2b9
commit a939163268
9 changed files with 23 additions and 17 deletions

4
Cargo.lock generated
View File

@ -1,6 +1,6 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
version = 4
[[package]]
name = "addr2line"
@ -19,7 +19,7 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
[[package]]
name = "advent_of_code"
version = "0.11.0"
version = "0.12.0"
dependencies = [
"chrono",
"dhat",

View File

@ -1,8 +1,8 @@
[package]
name = "advent_of_code"
version = "0.11.0"
version = "0.12.0"
authors = ["Felix Spöttel <1682504+fspoettel@users.noreply.github.com>"]
edition = "2021"
edition = "2024"
default-run = "advent_of_code"
publish = false

View File

@ -1,9 +1,11 @@
use crate::template::{aoc_cli, Day};
use crate::template::{Day, aoc_cli};
use std::process;
pub fn handle(day: Day) {
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);
}

View File

@ -1,10 +1,12 @@
use std::process;
use crate::template::{aoc_cli, Day};
use crate::template::{Day, aoc_cli};
pub fn handle(day: Day) {
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);
}

View File

@ -2,7 +2,7 @@ use std::collections::HashSet;
use crate::template::run_multi::run_multi;
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) {
let stored_timings = Timings::read_from_file();

View File

@ -143,7 +143,7 @@ macro_rules! day {
#[cfg(feature = "test_lib")]
mod tests {
use super::{all_days, Day};
use super::{Day, all_days};
#[test]
fn all_days_iterator() {

View File

@ -2,8 +2,8 @@
/// The approach taken is similar to how `aoc-readme-stars` handles this.
use std::{fs, io};
use crate::template::timings::Timings;
use crate::template::Day;
use crate::template::timings::Timings;
static MARKER: &str = "<!--- benchmarking table --->";
@ -99,7 +99,7 @@ pub fn update(timings: Timings) -> Result<(), Error> {
#[cfg(feature = "test_lib")]
mod tests {
use super::{update_content, MARKER};
use super::{MARKER, update_content};
use crate::{day, template::timings::Timing, template::timings::Timings};
fn get_mock_timings() -> Timings {

View File

@ -1,6 +1,6 @@
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::{
all_days,
@ -67,7 +67,7 @@ pub fn get_path_for_bin(day: Day) -> String {
/// All solutions live in isolated binaries.
/// This module encapsulates interaction with these binaries, both invoking them as well as parsing the timing output.
pub mod child_commands {
use super::{get_path_for_bin, Error};
use super::{Error, get_path_for_bin};
use crate::template::Day;
use std::{
io::{BufRead, BufReader},

View File

@ -1,13 +1,13 @@
/// Encapsulates code that interacts with solution functions.
use std::fmt::Display;
use std::hint::black_box;
use std::io::{stdout, Write};
use std::io::{Write, stdout};
use std::process::Output;
use std::time::{Duration, Instant};
use std::{cmp, env, process};
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) {
let part_str = format!("Part {part}");
@ -156,7 +156,9 @@ fn submit_result<T: Display>(
}
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);
}