1
Fork 0

Suggest alternatives to Error::description()

This commit is contained in:
Kornel 2018-04-22 19:17:08 +01:00
parent a5655b81a3
commit f6a833a99a

View file

@ -58,6 +58,8 @@ pub trait Error: Debug + Display {
/// new code should use [`Display`] instead /// new code should use [`Display`] instead
/// and new `impl`s can omit it. /// and new `impl`s can omit it.
/// ///
/// To obtain error description as a string, use `to_string()`.
///
/// [`Display`]: ../fmt/trait.Display.html /// [`Display`]: ../fmt/trait.Display.html
/// ///
/// # Examples /// # Examples
@ -73,7 +75,7 @@ pub trait Error: Debug + Display {
/// ``` /// ```
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn description(&self) -> &str { fn description(&self) -> &str {
"" "description() is deprecated; use Display"
} }
/// The lower-level cause of this error, if any. /// The lower-level cause of this error, if any.