Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 558e7a9

Browse files
Fix lint
1 parent ece0ac3 commit 558e7a9

File tree

9 files changed

+16
-12
lines changed

9 files changed

+16
-12
lines changed

‎README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ Performance is reasonable even on older hardware, for example a 2011 MacBook Pro
316316
| 20 | [Particle Swarm](https://adventofcode.com/2017/day/20) | [Source](src/year2017/day20.rs) | 245 |
317317
| 21 | [Fractal Art](https://adventofcode.com/2017/day/21) | [Source](src/year2017/day21.rs) | 5 |
318318
| 22 | [Sporifica Virus](https://adventofcode.com/2017/day/22) | [Source](src/year2017/day22.rs) | 36000 |
319-
| 23 | [Coprocessor Conflagration](https://adventofcode.com/2017/day/23) | [Source](src/year2017/day23.rs) | 54 |
319+
| 23 | [Coprocessor Conflagration](https://adventofcode.com/2017/day/23) | [Source](src/year2017/day23.rs) | 19 |
320320
| 24 | [Electromagnetic Moat](https://adventofcode.com/2017/day/24) | [Source](src/year2017/day24.rs) | 275 |
321321
| 25 | [The Halting Problem](https://adventofcode.com/2017/day/25) | [Source](src/year2017/day25.rs) | 3698 |
322322

‎src/util/slice.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ impl<T> SliceOps<T> for &mut [T] {
3131

3232
while i < n {
3333
if c[i] < i {
34-
if i % 2 == 0 {
34+
if i.is_multiple_of(2) {
3535
self.swap(0, i);
3636
} else {
3737
self.swap(c[i], i);

‎src/year2016/day15.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ fn solve(discs: &[Disc]) -> usize {
3232
let mut step = 1;
3333

3434
for (offset, &[size, position]) in discs.iter().enumerate() {
35-
while (time + offset + 1 + position) % size != 0 {
35+
while !(time + offset + 1 + position).is_multiple_of(size) {
3636
time += step;
3737
}
3838

‎src/year2017/day02.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub fn part2(input: &Input) -> u32 {
2828
.map(|values| {
2929
for i in 0..values.len() {
3030
for j in i + 1..values.len() {
31-
if values[j] % values[i] == 0 {
31+
if values[j].is_multiple_of(values[i]) {
3232
return values[j] / values[i];
3333
}
3434
}

‎src/year2017/day13.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ pub fn part1(input: &Input) -> u32 {
6969

7070
for &[depth, range] in input {
7171
let period = 2 * (range - 1);
72-
if depth % period == 0 {
72+
if depth.is_multiple_of(period) {
7373
result += depth * range;
7474
}
7575
}
@@ -93,7 +93,7 @@ pub fn part2(input: &Input) -> u32 {
9393
// Check each multiple of the current `end` against the new scanner.
9494
for extra in (0..next_lcm).step_by(lcm as usize) {
9595
for &delay in current.iter() {
96-
if (delay + extra + depth) % period != 0 {
96+
if !(delay + extra + depth).is_multiple_of(period) {
9797
next.push(delay + extra);
9898
}
9999
}

‎src/year2017/day23.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ pub fn part2(input: &u32) -> usize {
6969
/// Simple [prime number check](https://en.wikipedia.org/wiki/Primality_test)
7070
/// of all factors from 2 to √n inclusive.
7171
fn composite(n: u32) -> Option<u32> {
72-
if n % 2 == 0 {
72+
if n.is_multiple_of(2) {
7373
return Some(n);
74-
};
74+
}
7575
for f in (3..).step_by(2).take_while(|m| m * m <= n) {
76-
if n % f == 0 {
76+
if n.is_multiple_of(f) {
7777
return Some(n);
7878
}
7979
}

‎src/year2018/day19.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ fn divisor_sum(mut n: u32) -> u32 {
102102
let mut g = sum;
103103

104104
// `n` could have more than one of the same prime factor.
105-
while n % f == 0 {
105+
while n.is_multiple_of(f) {
106106
n /= f;
107107
g *= f;
108108
sum += g;

‎src/year2022/day11.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,11 @@ fn play(monkeys: &[Monkey], max_rounds: u32, adjust: impl Fn(u64) -> u64, pair:
173173
};
174174
item = adjust(worry);
175175

176-
let to = if item % monkeys[from].test == 0 { monkeys[from].yes } else { monkeys[from].no };
176+
let to = if item.is_multiple_of(monkeys[from].test) {
177+
monkeys[from].yes
178+
} else {
179+
monkeys[from].no
180+
};
177181

178182
// Only increase the round when the item is passes to a previous monkey
179183
// which will have to be processed in the next turn.

‎src/year2024/day07.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ fn valid(terms: &[u64], test_value: u64, index: usize, concat: bool) -> bool {
8383
(concat
8484
&& test_value % next_power_of_ten(terms[index]) == terms[index]
8585
&& valid(terms, test_value / next_power_of_ten(terms[index]), index - 1, concat))
86-
|| (test_value % terms[index] == 0
86+
|| (test_value.is_multiple_of(terms[index])
8787
&& valid(terms, test_value / terms[index], index - 1, concat))
8888
|| (test_value >= terms[index]
8989
&& valid(terms, test_value - terms[index], index - 1, concat))

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /