Skip to content

Commit f013084

Browse files
committed
Switch to latest Rust and fix warnings
1 parent f9f027d commit f013084

File tree

4 files changed

+19
-12
lines changed

4 files changed

+19
-12
lines changed

.github/workflows/rust.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ jobs:
1010
runs-on: ubuntu-latest
1111
strategy:
1212
matrix:
13-
projects: [ "2022", "2023", "2024", "shared" ]
14-
13+
projects: ["2022", "2023", "2024", "shared"]
14+
1515
steps:
1616
- uses: actions/checkout@v4
1717
- name: Update Rust to nightly

2022/src/bin/day20.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ impl<'a> Iterator for NodesIterator<'a> {
8282
}
8383
}
8484

85-
fn node_iterate(nodes: &Vec<NumberNode>) -> NodesIterator {
85+
fn node_iterate<'a>(nodes: &'a Vec<NumberNode>) -> NodesIterator<'a> {
8686
let zero_ix = nodes
8787
.iter()
8888
.enumerate()

2022/src/bin/day3.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![feature(test)]
2-
#![feature(array_chunks)]
32

43
use advent_lib::day_main;
54
use fxhash::FxHashSet;

shared/src/grid.rs

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -235,29 +235,37 @@ impl<T> Grid<T> {
235235
self.items.get_unchecked_mut((x + y * width) as usize)
236236
}
237237

238-
pub fn north_line(&self, x: i32) -> LineIterator<T> {
238+
pub fn north_line<'a>(&'a self, x: i32) -> LineIterator<'a, T> {
239239
LineIterator::North { grid: self, x, y: self.height() - 1 }
240240
}
241241

242-
pub fn east_line(&self, y: i32) -> LineIterator<T> {
242+
pub fn east_line<'a>(&'a self, y: i32) -> LineIterator<'a, T> {
243243
LineIterator::East { grid: self, x: 0, y }
244244
}
245245

246-
pub fn south_line(&self, x: i32) -> LineIterator<T> {
246+
pub fn south_line<'a>(&'a self, x: i32) -> LineIterator<'a, T> {
247247
LineIterator::South { grid: self, x, y: 0 }
248248
}
249249

250-
pub fn west_line(&self, y: i32) -> LineIterator<T> {
250+
pub fn west_line<'a>(&'a self, y: i32) -> LineIterator<'a, T> {
251251
LineIterator::West { grid: self, x: self.width() - 1, y }
252252
}
253253

254-
pub fn north_lines(&self) -> LinesIterator<T> { LinesIterator::North { grid: self, x: 0 } }
254+
pub fn north_lines<'a>(&'a self) -> LinesIterator<'a, T> {
255+
LinesIterator::North { grid: self, x: 0 }
256+
}
255257

256-
pub fn east_lines(&self) -> LinesIterator<T> { LinesIterator::East { grid: self, y: 0 } }
258+
pub fn east_lines<'a>(&'a self) -> LinesIterator<'a, T> {
259+
LinesIterator::East { grid: self, y: 0 }
260+
}
257261

258-
pub fn south_lines(&self) -> LinesIterator<T> { LinesIterator::South { grid: self, x: 0 } }
262+
pub fn south_lines<'a>(&'a self) -> LinesIterator<'a, T> {
263+
LinesIterator::South { grid: self, x: 0 }
264+
}
259265

260-
pub fn west_lines(&self) -> LinesIterator<T> { LinesIterator::West { grid: self, y: 0 } }
266+
pub fn west_lines<'a>(&'a self) -> LinesIterator<'a, T> {
267+
LinesIterator::West { grid: self, y: 0 }
268+
}
261269

262270
pub fn mut_line<F>(&mut self, start: Location, direction: Vector<2, i32>, function: F)
263271
where

0 commit comments

Comments
 (0)