mirror of
https://github.com/bertptrs/adventofcode.git
synced 2025-12-25 21:00:31 +01:00
Placate clippy
This commit is contained in:
@@ -5,7 +5,9 @@ use nom::IResult;
|
|||||||
|
|
||||||
use crate::common::parse_input;
|
use crate::common::parse_input;
|
||||||
|
|
||||||
fn parse_reports(mut i: &[u8]) -> IResult<&[u8], (Vec<Range<usize>>, Vec<i32>)> {
|
type Input = (Vec<Range<usize>>, Vec<i32>);
|
||||||
|
|
||||||
|
fn parse_reports(mut i: &[u8]) -> IResult<&[u8], Input> {
|
||||||
let mut begin = 0;
|
let mut begin = 0;
|
||||||
let mut numbers = Vec::new();
|
let mut numbers = Vec::new();
|
||||||
let mut ranges = Vec::new();
|
let mut ranges = Vec::new();
|
||||||
|
|||||||
@@ -53,7 +53,9 @@ fn number_ways(line: &[u8], groups: &[u8]) -> u64 {
|
|||||||
+ cur[(groups.len() - 1) * group_stride + groups[groups.len() - 1] as usize]
|
+ cur[(groups.len() - 1) * group_stride + groups[groups.len() - 1] as usize]
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_lines(i: &[u8]) -> IResult<&[u8], Vec<(&[u8], Vec<u8>)>> {
|
type LineAndGroups<'a> = Vec<(&'a [u8], Vec<u8>)>;
|
||||||
|
|
||||||
|
fn parse_lines(i: &[u8]) -> IResult<&[u8], LineAndGroups> {
|
||||||
many1(terminated(
|
many1(terminated(
|
||||||
separated_pair(
|
separated_pair(
|
||||||
take_until(" "),
|
take_until(" "),
|
||||||
|
|||||||
@@ -159,7 +159,9 @@ fn parse_rule(i: &[u8]) -> IResult<&[u8], (u16, Rule)> {
|
|||||||
Ok((&i[2..], (name, Rule { checks, end })))
|
Ok((&i[2..], (name, Rule { checks, end })))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_text(i: &[u8]) -> IResult<&[u8], (Box<[Rule]>, Vec<Item>)> {
|
type RulesAndItems = (Box<[Rule]>, Vec<Item>);
|
||||||
|
|
||||||
|
fn parse_text(i: &[u8]) -> IResult<&[u8], RulesAndItems> {
|
||||||
separated_pair(
|
separated_pair(
|
||||||
fold_many1(
|
fold_many1(
|
||||||
parse_rule,
|
parse_rule,
|
||||||
|
|||||||
@@ -77,7 +77,6 @@ fn simplify_graph(input: &[u8]) -> anyhow::Result<Vec<Vec<(Slope, usize, u32)>>>
|
|||||||
while let Some((dist, slope, x, y)) = todo_positions.pop() {
|
while let Some((dist, slope, x, y)) = todo_positions.pop() {
|
||||||
let mut enqueue = |x: usize, y: usize, up, down| {
|
let mut enqueue = |x: usize, y: usize, up, down| {
|
||||||
if map[(y, x)] == b'#' {
|
if map[(y, x)] == b'#' {
|
||||||
return;
|
|
||||||
} else if let Some(&other) = nodes.get(&(x, y)) {
|
} else if let Some(&other) = nodes.get(&(x, y)) {
|
||||||
if other == id {
|
if other == id {
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user