From 5ea444b418e2adf8fb9e6b34a67cff507d666bc1 Mon Sep 17 00:00:00 2001 From: ManicMarrc Date: Tue, 17 Oct 2023 04:54:15 +0700 Subject: [PATCH] fix(error): point to the correct variant on the docs url --- src/error.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/error.rs b/src/error.rs index 206d693..4e57a78 100644 --- a/src/error.rs +++ b/src/error.rs @@ -39,9 +39,13 @@ impl Diagnostic for MietteError { fn url<'a>(&'a self) -> Option> { 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, ))) } }