diff --git a/src/cargo_ops/elaborate_workspace.rs b/src/cargo_ops/elaborate_workspace.rs index 352755f..9144fbd 100644 --- a/src/cargo_ops/elaborate_workspace.rs +++ b/src/cargo_ops/elaborate_workspace.rs @@ -317,8 +317,8 @@ impl<'ela> ElaborateWorkspace<'ela> { "{}\t{}\t{}\t{}\t{:?}\t{}\n", label, pkg.version(), - status.compat.to_string(), - status.latest.to_string(), + status.compat, + status.latest, dependency.kind(), dependency .platform() @@ -331,8 +331,8 @@ impl<'ela> ElaborateWorkspace<'ela> { "{}\t{}\t{}\t{}\t---\t---\n", name, pkg.version(), - status.compat.to_string(), - status.latest.to_string() + status.compat, + status.latest ); lines.insert(line); } diff --git a/src/cargo_ops/pkg_status.rs b/src/cargo_ops/pkg_status.rs index 0156bfb..7c1e501 100644 --- a/src/cargo_ops/pkg_status.rs +++ b/src/cargo_ops/pkg_status.rs @@ -1,3 +1,5 @@ +use std::fmt; + use semver::Version; /// Enum which represents the update status of a package @@ -24,12 +26,12 @@ impl Status { pub fn is_changed(&self) -> bool { !matches!(*self, Status::Unchanged) } } -impl ::std::string::ToString for Status { - fn to_string(&self) -> String { - match *self { - Status::Unchanged => "---".to_owned(), - Status::Removed => "Removed".to_owned(), - Status::Version(ref v) => v.to_string(), +impl fmt::Display for Status { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Status::Unchanged => write!(f, "---"), + Status::Removed => write!(f, "Removed"), + Status::Version(version) => version.fmt(f), } } }