Skip to content

Commit 5d9c744

Browse files
committed
rust 1.89
1 parent e085ae9 commit 5d9c744

File tree

53 files changed

+195
-186
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+195
-186
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ All solutions are *tested* and *verified* with a lot of puzzle inputs and answer
7272

7373
By choice, I use the most recent versions of the languages, and therefore sometimes new paradigms and functionalities, since AoC is an excellent way to practice, explore and learn (while having fun!).
7474

75-
Rust solutions respect `cargo clippy -- -D clippy::all -F clippy::pedantic -F clippy::nursery`, which is a pretty strong hardening (except one `clippy::too_many_lines`).
75+
Rust solutions respect `cargo clippy -- -D clippy::all -F clippy::pedantic -F clippy::nursery`, which is a pretty strong hardening.
7676

7777
They also include, for the most part, unit tests taken from the examples of puzzle statements.
7878

crates/aoc/src/args.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ impl Args {
7070
}
7171

7272
#[must_use]
73-
pub fn params(&self) -> &[String] {
73+
pub const fn params(&self) -> &[String] {
7474
self.params.as_slice()
7575
}
7676
}

crates/aoc/src/coord.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ impl MulAssign<i32> for Coord {
152152

153153
impl From<u8> for Coord {
154154
#[inline]
155-
#[must_use]
156155
fn from(value: u8) -> Self {
157156
match value {
158157
b'^' | b'U' => Self::UP,
@@ -166,7 +165,6 @@ impl From<u8> for Coord {
166165

167166
impl From<char> for Coord {
168167
#[inline]
169-
#[must_use]
170168
fn from(value: char) -> Self {
171169
match value {
172170
'^' | 'U' => Self::UP,

crates/aoc/src/grid.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -337,11 +337,11 @@ impl<'a, T: Clone + Default> Iterator for Iter<'a, T> {
337337

338338
impl<T: Clone + Default> Grid<T> {
339339
#[must_use]
340-
pub fn iter(&self) -> Iter<T> {
340+
pub fn iter(&self) -> Iter<'_, T> {
341341
Iter::new(self)
342342
}
343343

344-
pub fn iter_mut(&mut self) -> IterMut<T> {
344+
pub fn iter_mut(&mut self) -> IterMut<'_, T> {
345345
IterMut::new(self)
346346
}
347347
}
@@ -368,7 +368,6 @@ impl<'a, T: Clone + Default> IntoIterator for &'a mut Grid<T> {
368368

369369
impl From<&str> for Grid<char> {
370370
#[inline]
371-
#[must_use]
372371
fn from(value: &str) -> Self {
373372
Self::parse(value, '#')
374373
}
@@ -420,7 +419,6 @@ impl std::fmt::Display for Grid<char> {
420419

421420
impl From<&str> for Grid<u8> {
422421
#[inline]
423-
#[must_use]
424422
fn from(value: &str) -> Self {
425423
Self::parse(value)
426424
}

crates/aoc/src/square.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ impl<T: Clone + Copy + Default> Square<T> {
153153
square.flip_vertical_inplace();
154154
}
155155
_ => panic!(),
156-
};
156+
}
157157
square.clone()
158158
})
159159
}

crates/assembunny/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ impl BunnyVM {
198198

199199
/// returns true if the program is finished (instruction pointer is out of bounds)
200200
#[must_use]
201-
pub fn is_terminated(&self) -> bool {
201+
pub const fn is_terminated(&self) -> bool {
202202
self.ip >= self.instructions.len()
203203
}
204204

@@ -266,7 +266,7 @@ impl BunnyVM {
266266
}
267267

268268
/// reset the program to the initial state
269-
pub fn reset(&mut self) {
269+
pub const fn reset(&mut self) {
270270
self.registers = [0, 0, 0, 0];
271271
self.ip = 0;
272272
self.output = None;

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ fn print_part_result(part: u8, answer: &str, ok: &str, day: u8) {
165165
println!("{}", answer.bright_green());
166166
} else {
167167
println!("{}", answer.bright_red());
168-
};
168+
}
169169
}
170170
}
171171

src/year2015/day18/day18.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ fn part2(data: &str) -> u32 {
5454
count_lights(&grid)
5555
}
5656

57-
fn corners_on(grid: &mut Grid) {
57+
const fn corners_on(grid: &mut Grid) {
5858
grid[0][0] = 1;
5959
grid[0][99] = 1;
6060
grid[99][0] = 1;

src/year2015/day22/day22.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ impl State {
4444
}
4545
}
4646

47-
fn apply_effects(&mut self) -> Option<CastResult> {
47+
const fn apply_effects(&mut self) -> Option<CastResult> {
4848
if self.timer_recharge > 0 {
4949
self.timer_recharge -= 1;
5050
self.mana += 101;

src/year2015/day23/day23.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ impl Puzzle {
7777
}
7878
}
7979
_ => (),
80-
};
80+
}
8181
1
8282
}
8383

0 commit comments

Comments
 (0)