'Simplest way to replace deprecated std::error::Error::description

warning: use of deprecated associated function `std::error::Error::description`: use the Display impl or to_string()

error::Error::description(self)

Does this justify the whole Display impl boilerplate or can I can away with the simpler to_string(). What was in description that's now deprecated (and I will miss dearly because of its simplicity)?



Solution 1:[1]

Add the Display implementation; that's how errors are done, now.

You can minimize boilerplate by using the thiserror derive macro library to generate one for you, using strings you annotate your error type with.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kevin Reid