Skip to content

Commit 4c814e4

Browse files
committed
Bump Rust version to 1.87
1 parent ff8eaeb commit 4c814e4

File tree

16 files changed

+27
-25
lines changed

16 files changed

+27
-25
lines changed

.github/workflows/checks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
runs-on: ubuntu-latest
2121
steps:
2222
- uses: actions/checkout@v4
23-
- run: rustup default 1.86
23+
- run: rustup default 1.87
2424
- run: cargo test
2525

2626
test-nightly:

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
url: ${{ steps.deployment.outputs.page_url }}
1919
steps:
2020
- uses: actions/checkout@v4
21-
- run: rustup default 1.86
21+
- run: rustup default 1.87
2222
- run: cargo doc
2323
env:
2424
RUSTDOCFLAGS: "--document-private-items --default-theme=ayu --deny warnings"

Cargo.toml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "aoc"
33
version = "2024.12.25"
44
edition = "2024"
5-
rust-version = "1.86"
5+
rust-version = "1.87"
66

77
[features]
88
frivolity = []
@@ -84,9 +84,11 @@ default_trait_access = "warn"
8484
default_union_representation = "warn"
8585
deref_by_slicing = "allow"
8686
disallowed_script_idents = "warn"
87+
doc_comment_double_space_linebreaks = "warn"
8788
doc_include_without_cfg = "warn"
8889
doc_link_with_quotes = "warn"
8990
doc_markdown = "warn"
91+
elidable_lifetime_names = "warn"
9092
else_if_without_else = "allow"
9193
empty_drop = "warn"
9294
empty_enum = "warn"
@@ -154,17 +156,17 @@ macro_use_imports = "warn"
154156
manual_assert = "warn"
155157
manual_c_str_literals = "warn"
156158
manual_instant_elapsed = "warn"
157-
manual_is_power_of_two = "warn"
159+
manual_is_power_of_two = "allow"
158160
manual_is_variant_and = "warn"
159161
manual_let_else = "warn"
162+
manual_midpoint = "warn"
160163
manual_ok_or = "warn"
161164
manual_string_new = "warn"
162165
many_single_char_names = "allow"
163166
map_err_ignore = "warn"
164167
map_unwrap_or = "warn"
165168
map_with_unused_argument_over_ranges = "warn"
166169
match_bool = "warn"
167-
match_on_vec_items = "allow"
168170
match_same_arms = "warn"
169171
match_wild_err_arm = "warn"
170172
match_wildcard_for_single_variants = "warn"
@@ -220,7 +222,7 @@ pub_without_shorthand = "warn"
220222
question_mark_used = "allow"
221223
range_minus_one = "warn"
222224
range_plus_one = "allow"
223-
return_and_then = "warn"
225+
return_and_then = "allow"
224226
rc_buffer = "warn"
225227
rc_mutex = "warn"
226228
redundant_closure_for_method_calls = "warn"
@@ -274,6 +276,7 @@ unicode_not_nfc = "warn"
274276
unimplemented = "warn"
275277
uninlined_format_args = "warn"
276278
unnecessary_box_returns = "warn"
279+
unnecessary_debug_formatting = "warn"
277280
unnecessary_join = "warn"
278281
unnecessary_literal_bound = "warn"
279282
unnecessary_safety_comment = "warn"

src/year2015/day03.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub fn part1(input: &[Point]) -> usize {
1818
}
1919

2020
pub fn part2(input: &[Point]) -> usize {
21-
deliver(input, |i| i % 2 == 0)
21+
deliver(input, |i| i.is_multiple_of(2))
2222
}
2323

2424
fn deliver(input: &[Point], predicate: fn(usize) -> bool) -> usize {

src/year2015/day23.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ fn execute(input: &[Op], mut a: u64) -> u64 {
7070
pc += 1;
7171
}
7272
Op::Jmp(index) => pc = index,
73-
Op::Jie(index) => pc = if a % 2 == 0 { index } else { pc + 1 },
73+
Op::Jie(index) => pc = if a.is_multiple_of(2) { index } else { pc + 1 },
7474
Op::Jio(index) => pc = if a == 1 { index } else { pc + 1 },
7575
}
7676
}

src/year2016/day13.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub fn parse(input: &str) -> Input {
2323
for y in 0..52 {
2424
let n = (x * x) + (3 * x) + (2 * x * y) + y + (y * y) + favorite;
2525
let ones = n.count_ones();
26-
maze[x][y] = ones % 2 == 0;
26+
maze[x][y] = ones.is_multiple_of(2);
2727
}
2828
}
2929

src/year2016/day16.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ fn checksum(input: &[usize], step_size: usize) -> String {
6666
.map(|i| count(input, i * step_size))
6767
.collect::<Vec<_>>()
6868
.windows(2)
69-
.map(|w| if (w[1] - w[0]) % 2 == 0 { '1' } else { '0' })
69+
.map(|w| if (w[1] - w[0]).is_multiple_of(2) { '1' } else { '0' })
7070
.collect()
7171
}
7272

src/year2017/day05.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ pub fn part2(input: &[i32]) -> usize {
9090
// Each time it crosses a block of 16 add to the compact binary representation.
9191
if jump[index] == 2 && index == fine {
9292
fine += 1;
93-
if fine % 16 == 0 {
93+
if fine.is_multiple_of(16) {
9494
let value = (coarse..fine).rev().fold(0, |acc, i| (acc << 1) | (jump[i] & 1));
9595
coarse = fine;
9696
compact.push(value as u16);

src/year2017/day15.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ fn sender(shared: &Shared, tx: &Sender<Block>) {
8282
if left == right {
8383
ones += 1;
8484
}
85-
if left % 4 == 0 {
85+
if left.is_multiple_of(4) {
8686
fours.push(left);
8787
}
88-
if right % 8 == 0 {
88+
if right.is_multiple_of(8) {
8989
eights.push(right);
9090
}
9191
}

src/year2018/day23.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ impl Cube {
5757
let Cube { x1, x2, y1, y2, z1, z2 } = *self;
5858

5959
// Lower and upper halves of the new sub-cubes.
60-
let lx = (self.x1 + self.x2) / 2;
61-
let ly = (self.y1 + self.y2) / 2;
62-
let lz = (self.z1 + self.z2) / 2;
60+
let lx = self.x1.midpoint(self.x2);
61+
let ly = self.y1.midpoint(self.y2);
62+
let lz = self.z1.midpoint(self.z2);
6363
let ux = lx + 1;
6464
let uy = ly + 1;
6565
let uz = lz + 1;

src/year2019/day02.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ fn search(input: &Input, x1: i32, x2: i32, y1: i32, y2: i32) -> Option<i32> {
5858
return None;
5959
}
6060

61-
let x = (x1 + x2) / 2;
62-
let y = (y1 + y2) / 2;
61+
let x = x1.midpoint(x2);
62+
let y = y1.midpoint(y2);
6363
let [a, b, c] = input;
6464
let result = a * x + b * y + c;
6565

src/year2021/day07.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ fn median(input: &[i32]) -> i32 {
3535
crabs.sort_unstable();
3636

3737
let half = input.len() / 2;
38-
let odd = crabs.len() % 2 == 1;
39-
40-
if odd { crabs[half] } else { (crabs[half - 1] + crabs[half]) / 2 }
38+
if crabs.len().is_multiple_of(2) { crabs[half - 1].midpoint(crabs[half]) } else { crabs[half] }
4139
}
4240

4341
fn mean(input: &[i32]) -> i32 {

src/year2022/day15.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ pub fn part2_testable(input: &[Input], size: i32) -> u64 {
112112
for &&y in &horizontal {
113113
// Rotate intersection point counter clockwise and scale by 1 / √2
114114
// to return to original coordinates.
115+
#[expect(clippy::manual_midpoint)]
115116
let point = Point::new((x + y) / 2, (y - x) / 2);
116117
// As we're mixing overlaps from different boxes there may some spurious false
117118
// positives, so double check all points are within the specified area

src/year2023/day06.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ fn race(first: &str, second: &str) -> u128 {
4646
// Use the quadratic formula to find the start and end positions.
4747
let root = (time * time - 4 * distance).isqrt();
4848
let mut start = (time - root).div_ceil(2);
49-
let mut end = (time + root) / 2;
49+
let mut end = time.midpoint(root);
5050

5151
// As we're using integer math we may need to adjust 1 step.
5252
if start * (time - start) > distance {

src/year2024/day09.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ pub fn part2(disk: &[usize]) -> usize {
7272
// Build a min-heap (leftmost free block first) where the size of each block is
7373
// implicit in the index of the array.
7474
for (index, &size) in disk.iter().enumerate() {
75-
if index % 2 == 1 && size > 0 {
75+
if !index.is_multiple_of(2) && size > 0 {
7676
free[size].push(block);
7777
}
7878

@@ -89,7 +89,7 @@ pub fn part2(disk: &[usize]) -> usize {
8989
block -= size;
9090

9191
// Count any previous free blocks to decrement block offset correctly.
92-
if index % 2 == 1 {
92+
if !index.is_multiple_of(2) {
9393
continue;
9494
}
9595

src/year2024/day11.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ fn count(input: &[u64], blinks: usize) -> u64 {
6161
(index_of(1), usize::MAX)
6262
} else {
6363
let digits = number.ilog10() + 1;
64-
if digits % 2 == 0 {
64+
if digits.is_multiple_of(2) {
6565
let power = 10_u64.pow(digits / 2);
6666
(index_of(number / power), index_of(number % power))
6767
} else {

0 commit comments

Comments
 (0)