We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
qpath_to_string
1 parent 5b47d34 commit 5c735d1Copy full SHA for 5c735d1
src/librustdoc/clean/utils.rs
@@ -24,7 +24,7 @@ use crate::clean::{
24
clean_middle_ty, inline,
25
};
26
use crate::core::DocContext;
27
-use crate::display::Joined as _;
+use crate::display::{Joined as _, MaybeDisplay as _};
28
29
#[cfg(test)]
30
mod tests;
@@ -254,14 +254,7 @@ pub(crate) fn qpath_to_string(p: &hir::QPath<'_>) -> String {
254
fmt::from_fn(|f| {
255
segments
256
.iter()
257
- .map(|seg| {
258
- fmt::from_fn(|f| {
259
- if seg.ident.name != kw::PathRoot {
260
- write!(f, "{}", seg.ident)?;
261
- }
262
- Ok(())
263
- })
264
+ .map(|seg| (seg.ident.name != kw::PathRoot).then_some(seg.ident).maybe_display())
265
.joined("::", f)
266
})
267
.to_string()
0 commit comments