Skip to content

Commit 5c735d1

Browse files
committed
Small cleanup for qpath_to_string
1 parent 5b47d34 commit 5c735d1

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

src/librustdoc/clean/utils.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use crate::clean::{
2424
clean_middle_ty, inline,
2525
};
2626
use crate::core::DocContext;
27-
use crate::display::Joined as _;
27+
use crate::display::{Joined as _, MaybeDisplay as _};
2828

2929
#[cfg(test)]
3030
mod tests;
@@ -254,14 +254,7 @@ pub(crate) fn qpath_to_string(p: &hir::QPath<'_>) -> String {
254254
fmt::from_fn(|f| {
255255
segments
256256
.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-
})
257+
.map(|seg| (seg.ident.name != kw::PathRoot).then_some(seg.ident).maybe_display())
265258
.joined("::", f)
266259
})
267260
.to_string()

0 commit comments

Comments
 (0)