address match style concerns

This commit is contained in:
Robert Habermeier
2016-05-22 12:41:45 -04:00
parent 3cba91bdd5
commit 5d997ef099
2 changed files with 54 additions and 141 deletions

View File

@@ -32,12 +32,11 @@ pub enum BaseDataError {
impl fmt::Display for BaseDataError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
BaseDataError::NegativelyReferencedHash(hash) => {
f.write_fmt(format_args!("Entry {} removed from database more times \
than it was added.", hash))
}
}
match *self {
BaseDataError::NegativelyReferencedHash(hash) =>
f.write_fmt(format_args!("Entry {} removed from database more times \
than it was added.", hash)),
}
}
}
@@ -116,18 +115,10 @@ pub struct OutOfBounds<T: fmt::Debug> {
impl<T: fmt::Debug + fmt::Display> fmt::Display for OutOfBounds<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let msg = match (self.min.as_ref(), self.max.as_ref()) {
(Some(min), Some(max)) => {
format!("Min={}, Max={}", min, max)
}
(Some(min), _) => {
format!("Min={}", min)
}
(_, Some(max)) => {
format!("Max={}", max)
}
(None, None) => {
"".into()
}
(Some(min), Some(max)) => format!("Min={}, Max={}", min, max),
(Some(min), _) => format!("Min={}", min),
(_, Some(max)) => format!("Max={}", max),
(None, None) => "".into(),
};
f.write_fmt(format_args!("Value {} out of bounds. {}", self.found, msg))