Move def_id_to_path to use site in visit_ast
This commit is contained in:
parent
65ea7b7947
commit
19c85a8f8a
2 changed files with 19 additions and 20 deletions
|
@ -39,7 +39,7 @@ use std::fmt;
|
|||
use std::hash::{Hash, Hasher};
|
||||
use std::default::Default;
|
||||
use std::{mem, slice, vec};
|
||||
use std::iter::{FromIterator, once};
|
||||
use std::iter::FromIterator;
|
||||
use std::rc::Rc;
|
||||
use std::cell::RefCell;
|
||||
use std::sync::Arc;
|
||||
|
@ -4398,24 +4398,6 @@ impl Clean<TypeBindingKind> for hir::TypeBindingKind {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn def_id_to_path(
|
||||
cx: &DocContext<'_>,
|
||||
did: DefId,
|
||||
name: Option<String>
|
||||
) -> Vec<String> {
|
||||
let crate_name = name.unwrap_or_else(|| cx.tcx.crate_name(did.krate).to_string());
|
||||
let relative = cx.tcx.def_path(did).data.into_iter().filter_map(|elem| {
|
||||
// extern blocks have an empty name
|
||||
let s = elem.data.to_string();
|
||||
if !s.is_empty() {
|
||||
Some(s)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
});
|
||||
once(crate_name).chain(relative).collect()
|
||||
}
|
||||
|
||||
pub fn enter_impl_trait<F, R>(cx: &DocContext<'_>, f: F) -> R
|
||||
where
|
||||
F: FnOnce() -> R,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue