diff options
| author | François Mockers <mockersf@gmail.com> | 2021-03-11 03:31:54 +0100 |
|---|---|---|
| committer | François Mockers <mockersf@gmail.com> | 2021-04-13 22:09:08 +0200 |
| commit | e1b6bb214fbc9d2a9af5c029679822e90dfd9660 (patch) | |
| tree | df88ef67b7a9e27584c038553b37a2edb036da5a | |
| parent | 5c1304205b7bc53a1e9f48cf286a60438351c1ab (diff) | |
| download | rust-e1b6bb214fbc9d2a9af5c029679822e90dfd9660.tar.gz rust-e1b6bb214fbc9d2a9af5c029679822e90dfd9660.zip | |
fix links from trait impl methods to trait declaration
| -rw-r--r-- | src/librustdoc/html/render/mod.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index fbe799e7184..a95cfc11367 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -912,10 +912,9 @@ fn render_assoc_item( let cache = cx.cache(); let tcx = cx.tcx(); let name = meth.name.as_ref().unwrap(); - let anchor = format!("#{}.{}", meth.type_(), name); let href = match link { AssocItemLink::Anchor(Some(ref id)) => format!("#{}", id), - AssocItemLink::Anchor(None) => anchor, + AssocItemLink::Anchor(None) => format!("#{}.{}", meth.type_(), name), AssocItemLink::GotoSource(did, provided_methods) => { // We're creating a link from an impl-item to the corresponding // trait-item and need to map the anchored type accordingly. @@ -925,7 +924,9 @@ fn render_assoc_item( ItemType::TyMethod }; - href(did, cache).map(|p| format!("{}#{}.{}", p.0, ty, name)).unwrap_or(anchor) + href(did, cache) + .map(|p| format!("{}#{}.{}", p.0, ty, name)) + .unwrap_or_else(|| format!("#{}.{}", ty, name)) } }; let vis = meth.visibility.print_with_space(tcx, meth.def_id, cache).to_string(); |
