[2018][rust][3.1] cargo clippy

sorbet
Alpha Chen 6 years ago
parent 0443116fde
commit ba3c219b7f

@ -28,7 +28,7 @@ fn solve(input: &str) -> Result<String, Box<Error>> {
fabric fabric
.entry(square_inch) .entry(square_inch)
.and_modify(|ids| ids.push(claim.id)) .and_modify(|ids| ids.push(claim.id))
.or_insert(vec![claim.id]); .or_insert_with(|| vec![claim.id]);
} }
fabric fabric
}, },
@ -37,8 +37,7 @@ fn solve(input: &str) -> Result<String, Box<Error>> {
let output = values let output = values
.iter() .iter()
.map(|ids| ids[0]) .map(|ids| ids[0])
.filter(|id| !values.iter().any(|ids| ids.len() > 1 && ids.contains(id))) .find(|id| !values.iter().any(|ids| ids.len() > 1 && ids.contains(id)))
.next()
.unwrap() .unwrap()
.to_string(); .to_string();
Ok(output) Ok(output)

Loading…
Cancel
Save