derive-error icon indicating copy to clipboard operation
derive-error copied to clipboard

Format description from argument

Open Tarmil opened this issue 6 years ago • 0 comments

I've recently needed something like the following:

#[derive(Debug, Error)]
enum Error {
    /// Unknown target: {}
    #[error(no_from, non_std)]
    UnknownTarget(String),
}

so that UnknownTarget("foo".to_owned()) would have "Unknown target: foo" as its description.

Currently the above actually fails to compile with error: 1 positional argument in format string, but no arguments were given, so this would not be a breaking change.

Tarmil avatar Jan 08 '19 15:01 Tarmil