diff options
| author | Christofer Bertonha <christofer.bertonha@typeform.com> | 2020-05-02 18:30:11 +0200 |
|---|---|---|
| committer | Christofer Bertonha <christofer.bertonha@typeform.com> | 2020-05-02 18:30:11 +0200 |
| commit | c301814d6809ee65b58ea525c3ee74df19616595 (patch) | |
| tree | aea65634d0ee4d4c5b38fae39052b04a380038af | |
| parent | 09478571df4e674b2007a6d0cd7257200f2e4dfb (diff) | |
chore: Remove deprecated description from error_handling/errorsn.rs
| -rw-r--r-- | exercises/error_handling/errorsn.rs | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/exercises/error_handling/errorsn.rs b/exercises/error_handling/errorsn.rs index 3079943..1b985bf 100644 --- a/exercises/error_handling/errorsn.rs +++ b/exercises/error_handling/errorsn.rs @@ -100,15 +100,12 @@ enum CreationError { impl fmt::Display for CreationError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_str((self as &dyn error::Error).description()) + let description = match *self { + CreationError::Negative => "Number is negative", + CreationError::Zero => "Number is zero", + }; + f.write_str(description) } } -impl error::Error for CreationError { - fn description(&self) -> &str { - match *self { - CreationError::Negative => "Negative", - CreationError::Zero => "Zero", - } - } -} +impl error::Error for CreationError {} |
