Cleaner
This commit is contained in:
parent
c5671587d5
commit
5bb3c29741
|
@ -6,6 +6,7 @@ fn main() {
|
|||
show_answers(note.smallests_distances(), note.similarity_score());
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
struct HistorianNote {
|
||||
left: Vec<i64>,
|
||||
right: Vec<i64>,
|
||||
|
@ -14,14 +15,13 @@ struct HistorianNote {
|
|||
impl FromStr for HistorianNote {
|
||||
type Err = ParseIntError;
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
let mut result = Self::default();
|
||||
let mut line_tokens = s.lines().map(|l| l.split_once(" "));
|
||||
let mut left = Vec::<i64>::new();
|
||||
let mut right = Vec::<i64>::new();
|
||||
while let Some((l, r)) = line_tokens.next().flatten() {
|
||||
left.push(l.parse()?);
|
||||
right.push(r.parse()?);
|
||||
result.left.push(l.parse()?);
|
||||
result.right.push(r.parse()?);
|
||||
}
|
||||
Ok(Self { left, right })
|
||||
Ok(result)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue