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 5c0fc8c

Browse files
Fix lints
1 parent 120d040 commit 5c0fc8c

File tree

5 files changed

+10
-8
lines changed

5 files changed

+10
-8
lines changed

‎src/year2016/day04.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub fn parse(input: &str) -> Vec<Room<'_>> {
2323
let size = line.len();
2424
let name = &line[..size - 11];
2525
let sector_id = (&line[size - 10..size - 7]).unsigned();
26-
let checksum = line[size - 6..size - 1].as_bytes();
26+
let checksum = &line.as_bytes()[size - 6..size - 1];
2727

2828
// Count the frequency of each digit, the frequency of each frequency `fof` and the
2929
// highest total frequency.

‎src/year2018/day12.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//! The trick for part two is that the plants will eventually stabilize into a repeating pattern
77
//! that expands by the same amount each generation. Once 2 deltas between 3 subsequent
88
//! generations are the same we extrapolate 50 billion generations into the future.
9-
use std::iter::repeat;
9+
use std::iter::repeat_n;
1010

1111
pub struct Input {
1212
rules: Vec<usize>,
@@ -73,7 +73,7 @@ fn step(rules: &[usize], tunnel: &Tunnel) -> Tunnel {
7373
let mut plants = Vec::with_capacity(1_000);
7474

7575
// Add four extra empty pots to the end to make checking the last pattern easier.
76-
for plant in tunnel.plants.iter().chain(repeat(&0).take(4)) {
76+
for plant in tunnel.plants.iter().copied().chain(repeat_n(0,4)) {
7777
index = ((index << 1) | plant) & 0b11111;
7878

7979
sum += position * rules[index] as i64;

‎src/year2019/day12.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@ type Input = [Axis; 3];
2323
/// Group each axis together
2424
pub fn parse(input: &str) -> Input {
2525
let n: Vec<_> = input.iter_signed().collect();
26-
[[n[0], n[3], n[6], n[9], 0, 0, 0, 0], [n[1], n[4], n[7], n[10], 0, 0, 0, 0], [
27-
n[2], n[5], n[8], n[11], 0, 0, 0, 0,
28-
]]
26+
[
27+
[n[0], n[3], n[6], n[9], 0, 0, 0, 0],
28+
[n[1], n[4], n[7], n[10], 0, 0, 0, 0],
29+
[n[2], n[5], n[8], n[11], 0, 0, 0, 0],
30+
]
2931
}
3032

3133
pub fn part1(input: &Input) -> i32 {

‎src/year2022/day16.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ pub struct Input {
6464
/// State of a single exploration path through the valves.
6565
///
6666
/// * `todo` Binary mask of unopened valves. For example if there are 3 unopened valves left this
67-
/// could look like `11100`.
67+
/// could look like `11100`.
6868
/// * `from` Index of current valve.
6969
/// * `time` The *remaining* time left.
7070
/// * `pressure` Total pressure released from all opened valves including future extrapolated flow.

‎src/year2023/day22.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
//! * `B` and `F` are both supported only by `A` so their depth is 1.
5757
//! * `C` will fall if either `A` or `B` is removed so its depth is 2.
5858
//! * `D` will only fall when `A` is removed. Removing `F` would leave it supported by `B` and `C`
59-
//! or vice-versa. The common ancestor of the path to the root is `A` so its depth is 1.
59+
//! or vice-versa. The common ancestor of the path to the root is `A` so its depth is 1.
6060
//! * `E`'s common ancestor is the floor so its depth is 0.
6161
//!
6262
//! In total `0 (A) + 0 (G) + 1 (B) + 1 (F) + 2 (C) + 1 (D) + 0 (E) = 5` bricks will fall.

0 commit comments

Comments
(0)

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