[2017][rust] delete .rustfmt temp file

sorbet
Alpha Chen 7 years ago
parent e596f64a69
commit 7b82b90b4c

@ -1,29 +0,0 @@
use std::collections::HashSet;
use failure::Error;
pub fn solve(input: &str) -> Result<String, Error> {
Ok(input
.trim()
.lines()
.map(|line| Passphrase { words: line.into() })
.filter(Passphrase::is_valid)
.count()
.to_string())
}
struct Passphrase {
words: String,
}
impl Passphrase {
fn is_valid(&self) -> bool {
let mut words = HashSet::new();
return !self.words.split_whitespace().any(|word| {
if words.contains(word) {
return true;
}
words.insert(word);
return false;
})
}
}
Loading…
Cancel
Save