Some formatting cleanups.

This commit is contained in:
2020-12-03 07:49:59 -08:00
parent 5a495ddc17
commit 12819f0eb8
2 changed files with 18 additions and 7 deletions

View File

@@ -38,7 +38,11 @@ impl FromStr for PasswordData {
impl PasswordData {
fn is_valid_interpretation1(&self) -> bool {
let count = self.password.chars().filter(|x| *x == self.character).count();
let count = self
.password
.chars()
.filter(|x| *x == self.character)
.count();
(count >= self.first_number) && (count <= self.second_number)
}
@@ -60,7 +64,6 @@ impl PasswordData {
}
}
fn real_main() -> Result<(), TopLevelError> {
let mut good_items_interpretation1 = 0u64;
let mut good_items_interpretation2 = 0u64;
@@ -83,8 +86,14 @@ fn real_main() -> Result<(), TopLevelError> {
}
}
println!("# of good passwords, according to interpretation #1: {}", good_items_interpretation1);
println!("# of good passwords, according to interpretation #2: {}", good_items_interpretation2);
println!(
"# of good passwords, according to interpretation #1: {}",
good_items_interpretation1
);
println!(
"# of good passwords, according to interpretation #2: {}",
good_items_interpretation2
);
Ok(())
}