rustc_tools_util: clean up pedantic clippy warnings
This commit is contained in:
parent
e8400061bd
commit
19802f8652
1 changed files with 27 additions and 31 deletions
|
@ -39,9 +39,8 @@ pub struct VersionInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::fmt::Display for VersionInfo {
|
impl std::fmt::Display for VersionInfo {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
match self.commit_hash {
|
if self.commit_hash.is_some() {
|
||||||
Some(_) => {
|
|
||||||
write!(
|
write!(
|
||||||
f,
|
f,
|
||||||
"{} {}.{}.{} ({} {})",
|
"{} {}.{}.{} ({} {})",
|
||||||
|
@ -52,35 +51,32 @@ impl std::fmt::Display for VersionInfo {
|
||||||
self.commit_hash.clone().unwrap_or_default().trim(),
|
self.commit_hash.clone().unwrap_or_default().trim(),
|
||||||
self.commit_date.clone().unwrap_or_default().trim(),
|
self.commit_date.clone().unwrap_or_default().trim(),
|
||||||
)?;
|
)?;
|
||||||
},
|
} else {
|
||||||
None => {
|
|
||||||
write!(f, "{} {}.{}.{}", self.crate_name, self.major, self.minor, self.patch)?;
|
write!(f, "{} {}.{}.{}", self.crate_name, self.major, self.minor, self.patch)?;
|
||||||
},
|
}
|
||||||
};
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::fmt::Debug for VersionInfo {
|
impl std::fmt::Debug for VersionInfo {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
write!(
|
write!(
|
||||||
f,
|
f,
|
||||||
"VersionInfo {{ crate_name: \"{}\", major: {}, minor: {}, patch: {}",
|
"VersionInfo {{ crate_name: \"{}\", major: {}, minor: {}, patch: {}",
|
||||||
self.crate_name, self.major, self.minor, self.patch,
|
self.crate_name, self.major, self.minor, self.patch,
|
||||||
)?;
|
)?;
|
||||||
match self.commit_hash {
|
if self.commit_hash.is_some() {
|
||||||
Some(_) => {
|
|
||||||
write!(
|
write!(
|
||||||
f,
|
f,
|
||||||
", commit_hash: \"{}\", commit_date: \"{}\" }}",
|
", commit_hash: \"{}\", commit_date: \"{}\" }}",
|
||||||
self.commit_hash.clone().unwrap_or_default().trim(),
|
self.commit_hash.clone().unwrap_or_default().trim(),
|
||||||
self.commit_date.clone().unwrap_or_default().trim()
|
self.commit_date.clone().unwrap_or_default().trim()
|
||||||
)?;
|
)?;
|
||||||
},
|
} else {
|
||||||
None => {
|
|
||||||
write!(f, " }}")?;
|
write!(f, " }}")?;
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue