mirror of
https://github.com/rust-lang/rustlings.git
synced 2024-12-26 00:00:03 +03:00
chore: Remove deprecated description from error_handling/errorsn.rs
This commit is contained in:
parent
09478571df
commit
c301814d68
|
@ -100,15 +100,12 @@ enum CreationError {
|
||||||
|
|
||||||
impl fmt::Display for CreationError {
|
impl fmt::Display for CreationError {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
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 {
|
impl error::Error for CreationError {}
|
||||||
fn description(&self) -> &str {
|
|
||||||
match *self {
|
|
||||||
CreationError::Negative => "Negative",
|
|
||||||
CreationError::Zero => "Zero",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue