Skip to content

Commit 0c70319

Browse files
committed
refactor: compare lockfile use Iterator.eq
1 parent d86745b commit 0c70319

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

src/cargo/ops/lockfile.rs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -188,20 +188,7 @@ fn are_equal_lockfiles(orig: &str, current: &str, ws: &Workspace<'_>) -> bool {
188188
}
189189
}
190190

191-
let mut orig_iter = orig.lines();
192-
let mut current_iter = current.lines();
193-
loop {
194-
match (orig_iter.next(), current_iter.next()) {
195-
(Some(o), Some(c)) => {
196-
if o != c {
197-
return false;
198-
}
199-
}
200-
(Some(_), None) => return false,
201-
(None, Some(_)) => return false,
202-
(None, None) => return true,
203-
}
204-
}
191+
orig.lines().eq(current.lines())
205192
}
206193

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

0 commit comments

Comments
 (0)