diff options
| author | Yotam Ofek <yotam.ofek@gmail.com> | 2025-05-21 21:11:30 +0000 |
|---|---|---|
| committer | Yotam Ofek <yotam.ofek@gmail.com> | 2025-05-23 12:37:56 +0000 |
| commit | 5c735d154e1d2bc2844039ef5b13b4872a5404ef (patch) | |
| tree | 038ce402e29bf0966f64a02e768fc6aa48c507ab /src/librustdoc/clean/utils.rs | |
| parent | 5b47d340d360760dd6d33587c0431414cf550ac9 (diff) | |
| download | rust-5c735d154e1d2bc2844039ef5b13b4872a5404ef.tar.gz rust-5c735d154e1d2bc2844039ef5b13b4872a5404ef.zip | |
Small cleanup for `qpath_to_string`
Diffstat (limited to 'src/librustdoc/clean/utils.rs')
| -rw-r--r-- | src/librustdoc/clean/utils.rs | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/src/librustdoc/clean/utils.rs b/src/librustdoc/clean/utils.rs index d3617e682ca..2e38b6cdc65 100644 --- a/src/librustdoc/clean/utils.rs +++ b/src/librustdoc/clean/utils.rs @@ -24,7 +24,7 @@ use crate::clean::{ clean_middle_ty, inline, }; use crate::core::DocContext; -use crate::display::Joined as _; +use crate::display::{Joined as _, MaybeDisplay as _}; #[cfg(test)] mod tests; @@ -254,14 +254,7 @@ pub(crate) fn qpath_to_string(p: &hir::QPath<'_>) -> String { fmt::from_fn(|f| { segments .iter() - .map(|seg| { - fmt::from_fn(|f| { - if seg.ident.name != kw::PathRoot { - write!(f, "{}", seg.ident)?; - } - Ok(()) - }) - }) + .map(|seg| (seg.ident.name != kw::PathRoot).then_some(seg.ident).maybe_display()) .joined("::", f) }) .to_string() |
