all: fix clippy lints for rust 1.65
This commit is contained in:
parent
1d9433098d
commit
008fb72a98
11 changed files with 21 additions and 39 deletions
|
|
@ -111,9 +111,8 @@ impl Layout {
|
|||
count += self
|
||||
.grid
|
||||
.get(i)
|
||||
.map(|line| line.get(j))
|
||||
.flatten()
|
||||
.map(|&cell| if cell == value { 1 } else { 0 })
|
||||
.and_then(|line| line.get(j))
|
||||
.map(|&cell| u8::from(cell == value))
|
||||
.unwrap_or(0);
|
||||
}
|
||||
|
||||
|
|
@ -131,7 +130,7 @@ impl Layout {
|
|||
|
||||
let (i, j) = (i.wrapping_add(di as usize), j.wrapping_add(dj as usize));
|
||||
|
||||
let cell = self.grid.get(i).map(|line| line.get(j)).flatten();
|
||||
let cell = self.grid.get(i).and_then(|line| line.get(j));
|
||||
|
||||
match cell {
|
||||
// keep going, the next seat is farther away
|
||||
|
|
|
|||
|
|
@ -22,8 +22,7 @@ fn part1(input: &str) -> Result<u64> {
|
|||
|
||||
Ok(tickets
|
||||
.iter()
|
||||
.map(|t| t.invalid_values(&fields_vec))
|
||||
.flatten()
|
||||
.flat_map(|t| t.invalid_values(&fields_vec))
|
||||
.sum())
|
||||
}
|
||||
|
||||
|
|
@ -224,7 +223,7 @@ mod tests {
|
|||
|
||||
let matches = assign_field_positions(fields, tickets);
|
||||
|
||||
let expected = (&["row", "class", "seat"])
|
||||
let expected = ["row", "class", "seat"]
|
||||
.iter()
|
||||
.copied()
|
||||
.enumerate()
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ fn mul(input: &str) -> IResult<&str, Expr> {
|
|||
}
|
||||
|
||||
fn num(input: &str) -> IResult<&str, Expr> {
|
||||
map_res(take_while1(|c: char| c.is_digit(10)), |res: &str| {
|
||||
map_res(take_while1(|c: char| c.is_ascii_digit()), |res: &str| {
|
||||
res.parse().map(Expr::Num)
|
||||
})(input)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue