Skip to content

Commit c60d317

Browse files
committed
refactor(resolve): Give report_latest more formatting control
1 parent 59ecb11 commit c60d317

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/cargo/ops/cargo_update.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -759,18 +759,16 @@ fn report_latest(possibilities: &[IndexSummary], package: PackageId) -> Option<S
759759
return None;
760760
}
761761

762-
possibilities
762+
let version = possibilities
763763
.iter()
764764
.map(|s| s.as_summary())
765765
.filter(|s| is_latest(s.version(), package.version()))
766766
.map(|s| s.version().clone())
767-
.max()
768-
.map(format_latest)
769-
}
767+
.max()?;
770768

771-
fn format_latest(version: semver::Version) -> String {
772769
let warn = style::WARN;
773-
format!(" {warn}(latest: v{version}){warn:#}")
770+
let report = format!(" {warn}(latest: v{version}){warn:#}");
771+
Some(report)
774772
}
775773

776774
fn is_latest(candidate: &semver::Version, current: &semver::Version) -> bool {

0 commit comments

Comments
 (0)