derive-error
derive-error copied to clipboard
Format description from argument
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.