Skip to content

Commit cb2bdea

Browse files
committed
refactor(resolve): Pull put locking message
1 parent 17a11e4 commit cb2bdea

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/cargo/ops/cargo_generate_lockfile.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,7 @@ fn print_lockfile_generation(
212212
// just ourself, nothing worth reporting
213213
return Ok(());
214214
}
215-
ws.gctx()
216-
.shell()
217-
.status("Locking", format!("{num_pkgs} packages"))?;
215+
status_locking(ws, num_pkgs)?;
218216

219217
for diff in diff {
220218
fn format_latest(version: semver::Version) -> String {
@@ -271,10 +269,7 @@ fn print_lockfile_sync(
271269
if num_pkgs == 0 {
272270
return Ok(());
273271
}
274-
let plural = if num_pkgs == 1 { "" } else { "s" };
275-
ws.gctx()
276-
.shell()
277-
.status("Locking", format!("{num_pkgs} package{plural}"))?;
272+
status_locking(ws, num_pkgs)?;
278273

279274
for diff in diff {
280275
fn format_latest(version: semver::Version) -> String {
@@ -488,6 +483,14 @@ fn print_lockfile_updates(
488483
Ok(())
489484
}
490485

486+
fn status_locking(ws: &Workspace<'_>, num_pkgs: usize) -> CargoResult<()> {
487+
let plural = if num_pkgs == 1 { "" } else { "s" };
488+
ws.gctx()
489+
.shell()
490+
.status("Locking", format!("{num_pkgs} package{plural}"))?;
491+
Ok(())
492+
}
493+
491494
fn is_latest(candidate: &semver::Version, current: &semver::Version) -> bool {
492495
current < candidate
493496
// Only match pre-release if major.minor.patch are the same

0 commit comments

Comments
 (0)