Skip to content

Commit

Permalink
refactor: compare lockfile use Iterator.eq
Browse files Browse the repository at this point in the history
  • Loading branch information
weihanglo committed Aug 23, 2020
1 parent d86745b commit 0c70319
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions src/cargo/ops/lockfile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,20 +188,7 @@ fn are_equal_lockfiles(orig: &str, current: &str, ws: &Workspace<'_>) -> bool {
}
}

let mut orig_iter = orig.lines();
let mut current_iter = current.lines();
loop {
match (orig_iter.next(), current_iter.next()) {
(Some(o), Some(c)) => {
if o != c {
return false;
}
}
(Some(_), None) => return false,
(None, Some(_)) => return false,
(None, None) => return true,
}
}
orig.lines().eq(current.lines())
}

fn emit_package(dep: &toml::value::Table, out: &mut String) {
Expand Down

0 comments on commit 0c70319

Please sign in to comment.