diff --git a/src/eyreish/into_diagnostic.rs b/src/eyreish/into_diagnostic.rs index e09f2a9..060c2fa 100644 --- a/src/eyreish/into_diagnostic.rs +++ b/src/eyreish/into_diagnostic.rs @@ -10,12 +10,19 @@ struct DiagnosticError(Box); impl Diagnostic for DiagnosticError {} /** -Convenience trait that adds a `.into_diagnostic()` method that converts a type -to a `Result`. +Convenience trait that adds a [`.into_diagnostic()`](IntoDiagnostic::into_diagnostic) method that converts a type implementing +[`std::error::Error`] to a [`Result`]. + +## Warning + +Calling this on a type implementing [`Diagnostic`] will reduce it to the common denominator of +[`std::error::Error`]. Meaning all extra information provided by [`Diagnostic`] will be +inaccessible. If you have a type implementing [`Diagnostic`] consider simply returning it or using +[`Into`] or the [`Try`](std::ops::Try) operator (`?`). */ pub trait IntoDiagnostic { - /// Converts [`Result`]-like types that return regular errors into a - /// `Result` that returns a [`Diagnostic`]. + /// Converts [`Result`] types that return regular [`std::error::Error`]s into a + /// [`Result`] that returns a [`Diagnostic`]. fn into_diagnostic(self) -> Result; }