Skip to content

Commit 028ae5c

Browse files
committed
Update to Rust 1.85 and 2024 edition
1 parent 254265e commit 028ae5c

File tree

18 files changed

+85
-78
lines changed

18 files changed

+85
-78
lines changed

Cargo.toml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,21 @@ default-members = ["crates/aoc", "crates/utils", "crates/year*"]
66

77
[workspace.package]
88
authors = ["Ethan Jones <[email protected]>"]
9-
edition = "2021"
9+
edition = "2024"
1010
license = "MIT"
1111
publish = false
1212
repository = "https://github.com/ictrobot/aoc-rs"
13-
rust-version = "1.83.0"
13+
rust-version = "1.85.0"
1414

1515
[workspace.lints.clippy]
1616
pedantic = { level = "warn", priority = -1 }
17+
allow_attributes = "deny"
18+
dbg_macro = "warn"
1719
missing_errors_doc = "allow"
1820
missing_panics_doc = "allow"
1921
module_name_repetitions = "allow"
20-
allow_attributes = "deny"
22+
print_stderr = "warn"
23+
print_stdout = "warn"
2124

2225
[profile.release]
2326
debug = "limited"

crates/aoc/src/cli/options.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
use aoc::{PuzzleFn, PUZZLES};
1+
use aoc::{PUZZLES, PuzzleFn};
22
use std::collections::VecDeque;
33
use std::error::Error;
44
use std::num::NonZeroUsize;
55
use utils::date::{Day, Year};
6-
use utils::multiversion::{Version, VERSIONS};
6+
use utils::multiversion::{VERSIONS, Version};
77

88
#[derive(Debug, Default)]
99
pub struct Options {
@@ -88,7 +88,7 @@ impl Options {
8888

8989
pub fn help(&self) -> String {
9090
format!(
91-
r#"Usage:
91+
r"Usage:
9292
{program_name}
9393
Run all solutions
9494
@@ -109,7 +109,7 @@ Options:
109109
--help/-h
110110
Print this help
111111
112-
{cargo_repo}"#,
112+
{cargo_repo}",
113113
program_name = self.program_name.as_ref().map_or("aoc", String::as_str),
114114
multiversion_options = *VERSIONS,
115115
cargo_repo = env!("CARGO_PKG_REPOSITORY"),

crates/aoc/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ mod puzzles;
22
mod years;
33

44
pub use ::utils;
5-
pub use puzzles::{PuzzleFn, PUZZLES};
5+
pub use puzzles::{PUZZLES, PuzzleFn};
66
pub use years::*;

crates/aoc/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use utils::multiversion::Version;
1010

1111
mod cli;
1212

13+
#[expect(clippy::print_stdout, clippy::print_stderr)]
1314
fn main() {
1415
let args = match Options::parse() {
1516
Ok(x) => x,

crates/aoc/src/puzzles.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ use utils::date::{Day, Year};
44
// These imports are unused if none of the year features are enabled
55
#[allow(clippy::allow_attributes, unused_imports)]
66
use utils::{
7-
input::{InputError, InputType},
87
Puzzle,
8+
input::{InputError, InputType},
99
};
1010

1111
/// Represents a wrapper function around a puzzle solution.

crates/aoc_wasm/src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ fn run(
7777

7878
unsafe fn write_string(buf: *mut u8, str: &str) {
7979
let len = str.len().min(BUFFER_LENGTH - 1);
80-
std::ptr::copy_nonoverlapping(str.as_ptr(), buf, len);
81-
*buf.add(len) = 0;
80+
unsafe {
81+
std::ptr::copy_nonoverlapping(str.as_ptr(), buf, len);
82+
*buf.add(len) = 0;
83+
}
8284
}

crates/aoc_wasm/src/multithreading.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use aoc::utils::wasm::scoped_tasks::worker;
2-
use std::alloc::{alloc_zeroed, Layout};
2+
use std::alloc::{Layout, alloc_zeroed};
33

44
/// Allocate stack for worker threads.
55
///

crates/utils/src/multiversion.rs

Lines changed: 32 additions & 32 deletions
Large diffs are not rendered by default.

crates/utils/src/parser/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ mod then;
1313
pub use base::*;
1414
pub use error::ParseError;
1515
pub use iterator::{ParserIterator, ParserMatchesIterator};
16-
pub use number::{i128, i16, i32, i64, i8, number_range, u128, u16, u32, u64, u8};
16+
pub use number::{i8, i16, i32, i64, i128, number_range, u8, u16, u32, u64, u128};
1717
pub use one_of::one_of;
1818
pub use simple::{byte, byte_range, constant, eof, eol, noop, take_while, take_while1};
1919

crates/utils/src/wasm/scoped_tasks.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
use std::any::Any;
5858
use std::collections::VecDeque;
5959
use std::marker::PhantomData;
60-
use std::panic::{catch_unwind, resume_unwind, AssertUnwindSafe};
60+
use std::panic::{AssertUnwindSafe, catch_unwind, resume_unwind};
6161
use std::sync::mpsc::{SyncSender, TrySendError};
6262
use std::sync::{Arc, Condvar, Mutex};
6363

@@ -170,7 +170,6 @@ impl<'scope, 'env> Scope<'scope, 'env> {
170170
// returning too soon, while the closures still exist, which causes UB as detected
171171
// by Miri.
172172
let panicked = closure();
173-
dbg!("finished");
174173
scope_data.task_end(panicked);
175174
},
176175
));

0 commit comments

Comments
 (0)