|
|
|
|
@ -15,24 +15,25 @@ pub(crate) struct VersionInfo {
|
|
|
|
|
|
|
|
|
|
impl fmt::Display for VersionInfo {
|
|
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
|
|
|
write!(f, "{}", self.version)?;
|
|
|
|
|
write!(f, "{}\n\n", self.version)?;
|
|
|
|
|
|
|
|
|
|
match (&self.commit_info, self.rustc_version) {
|
|
|
|
|
(Some(commit_info), Some(rustc_version)) => write!(
|
|
|
|
|
if let Some(commit_info) = &self.commit_info {
|
|
|
|
|
writeln!(
|
|
|
|
|
f,
|
|
|
|
|
" ({} {}, built with rustc {})",
|
|
|
|
|
commit_info.short_commit_hash, commit_info.commit_date, rustc_version
|
|
|
|
|
)?,
|
|
|
|
|
(Some(commit_info), None) => write!(
|
|
|
|
|
f,
|
|
|
|
|
" ({} {})",
|
|
|
|
|
"Revision: {} {}",
|
|
|
|
|
commit_info.short_commit_hash, commit_info.commit_date
|
|
|
|
|
)?,
|
|
|
|
|
(None, Some(rustc_version)) => write!(f, " (built with rustc {})", rustc_version)?,
|
|
|
|
|
(None, None) => {}
|
|
|
|
|
)?;
|
|
|
|
|
}
|
|
|
|
|
if let Some(rustc_version) = self.rustc_version {
|
|
|
|
|
writeln!(f, "Toolchain: {}", rustc_version)?;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
|
writeln!(
|
|
|
|
|
f,
|
|
|
|
|
"System: {} {}",
|
|
|
|
|
std::env::consts::OS,
|
|
|
|
|
std::env::consts::ARCH
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|