fix(error): point to the correct variant on the docs url

This commit is contained in:
ManicMarrc 2023-10-17 04:54:15 +07:00
parent 2450afce9e
commit 5ea444b418
1 changed files with 6 additions and 2 deletions

View File

@ -39,9 +39,13 @@ impl Diagnostic for MietteError {
fn url<'a>(&'a self) -> Option<Box<dyn fmt::Display + 'a>> {
let crate_version = env!("CARGO_PKG_VERSION");
let variant = match self {
MietteError::IoError(_) => "#variant.IoError",
MietteError::OutOfBounds => "#variant.OutOfBounds",
};
Some(Box::new(format!(
"https://docs.rs/miette/{}/miette/enum.MietteError.html",
crate_version,
"https://docs.rs/miette/{}/miette/enum.MietteError.html{}",
crate_version, variant,
)))
}
}