diff options
Diffstat (limited to 'src/bin')
| -rw-r--r-- | src/bin/2.rs | 10 | 
1 files changed, 5 insertions, 5 deletions
| diff --git a/src/bin/2.rs b/src/bin/2.rs index a674c9a..1f13ba7 100644 --- a/src/bin/2.rs +++ b/src/bin/2.rs @@ -29,7 +29,7 @@ impl Dir {              Self::Ascending => b - a,              Self::Descending => a - b,          }; -        diff >= 1 && diff <= 3 +        (1..=3).contains(&diff)      }  } @@ -45,7 +45,7 @@ fn p1cond(report: &[i16]) -> bool {              return false;          }      } -    return true; +    true  }  fn p2cond(report: &[i16]) -> bool { @@ -74,7 +74,7 @@ fn p2cond(report: &[i16]) -> bool {          }          return true;      } -    return false; +    false  }  fn main() -> Result<(), Box<dyn Error>> { @@ -91,7 +91,7 @@ fn main() -> Result<(), Box<dyn Error>> {          input.push(elems);      }      let input = input.into_boxed_slice(); -    println!("{}", input.iter().filter(|e| p1cond(*e)).count()); -    println!("{}", input.iter().filter(|e| p2cond(*e)).count()); +    println!("{}", input.iter().filter(|e| p1cond(e)).count()); +    println!("{}", input.iter().filter(|e| p2cond(e)).count());      Ok(())  } | 
