Skip to content

Commit

Permalink
fix(docsrs): use proper module names for docsrs URLs
Browse files Browse the repository at this point in the history
Fixes: #147
  • Loading branch information
zkat committed Apr 3, 2022
1 parent b4a9d4c commit a0b972f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions miette-derive/src/url.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,14 @@ impl Url {
Url::DocsRs => {
let pat = gen_unused_pat(fields);
let fmt =
"https://docs.rs/{crate_name}/{crate_version}/{crate_name}/{item_path}"
"https://docs.rs/{crate_name}/{crate_version}/{mod_name}/{item_path}"
.into();
let item_path = format!("enum.{}.html#variant.{}", enum_name, ident);
let args = quote! {
,
crate_name=env!("CARGO_PKG_NAME"),
crate_version=env!("CARGO_PKG_VERSION"),
mod_name=env!("CARGO_PKG_NAME").replace('-', "_"),
item_path=#item_path
};
(pat, fmt, args)
Expand All @@ -115,12 +116,13 @@ impl Url {
Url::DocsRs => {
let pat = gen_unused_pat(fields);
let fmt =
"https://docs.rs/{crate_name}/{crate_version}/{crate_name}/{item_path}".into();
"https://docs.rs/{crate_name}/{crate_version}/{mod_name}/{item_path}".into();
let item_path = format!("struct.{}.html", struct_name);
let args = quote! {
,
crate_name=env!("CARGO_PKG_NAME"),
crate_version=env!("CARGO_PKG_VERSION"),
mod_name=env!("CARGO_PKG_NAME").replace('-', "_"),
item_path=#item_path
};
(pat, fmt, args)
Expand Down

0 comments on commit a0b972f

Please sign in to comment.