|
1 | 1 | use std::cell::RefCell; |
2 | 2 | use std::default::Default; |
| 3 | +use std::fmt::Write; |
3 | 4 | use std::hash::Hash; |
4 | 5 | use std::lazy::SyncOnceCell as OnceCell; |
5 | 6 | use std::path::PathBuf; |
@@ -40,6 +41,7 @@ use crate::formats::cache::Cache; |
40 | 41 | use crate::formats::item_type::ItemType; |
41 | 42 | use crate::html::render::cache::ExternalLocation; |
42 | 43 | use crate::html::render::Context; |
| 44 | +use crate::passes::collect_intra_doc_links::UrlFragment; |
43 | 45 |
|
44 | 46 | crate use self::FnRetTy::*; |
45 | 47 | crate use self::ItemKind::*; |
@@ -485,8 +487,7 @@ impl Item { |
485 | 487 | if let Ok((mut href, ..)) = href(*did, cx) { |
486 | 488 | debug!(?href); |
487 | 489 | if let Some(ref fragment) = *fragment { |
488 | | - href.push('#'); |
489 | | - href.push_str(fragment); |
| 490 | + write!(href, "{}", fragment).unwrap() |
490 | 491 | } |
491 | 492 | Some(RenderedLink { |
492 | 493 | original_text: s.clone(), |
@@ -977,7 +978,7 @@ crate struct ItemLink { |
977 | 978 | pub(crate) link_text: String, |
978 | 979 | pub(crate) did: DefId, |
979 | 980 | /// The url fragment to append to the link |
980 | | - pub(crate) fragment: Option<String>, |
| 981 | + pub(crate) fragment: Option<UrlFragment>, |
981 | 982 | } |
982 | 983 |
|
983 | 984 | pub struct RenderedLink { |
|
0 commit comments