Closed
Description
https://doc.rust-lang.org/std/error/trait.Error.html#method.source.
The documentation example contains the deprecated std::error::Error::description
method in the main
function:
fn main() {
match get_super_error() {
Err(e) => {
println!("Error: {}", e.description()); // <----------- HERE IT IS
println!("Caused by: {}", e.source().unwrap());
}
_ => println!("No error"),
}
}
This is probably a mistake as get_super_error
returns a struct
that impl
ements the std::fmt::Display
trait which should be used instead of the deprecated std::error::Error::description
method. So, this:
println!("Error: {}", e.description());
...should be written like this:
println!("Error: {}", e);
Metadata
Metadata
Assignees
Labels
No labels