mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
Merge #9637
9637: Overhaul doc_links testing infra r=Veykril a=Veykril and fix several issues with current implementation. Fixes #9617 Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
commit
4705df44c7
9 changed files with 633 additions and 778 deletions
|
@ -295,12 +295,19 @@ impl ModuleDef {
|
|||
}
|
||||
|
||||
pub fn canonical_path(&self, db: &dyn HirDatabase) -> Option<String> {
|
||||
let mut segments = vec![self.name(db)?.to_string()];
|
||||
let mut segments = vec![self.name(db)?];
|
||||
for m in self.module(db)?.path_to_root(db) {
|
||||
segments.extend(m.name(db).map(|it| it.to_string()))
|
||||
segments.extend(m.name(db))
|
||||
}
|
||||
segments.reverse();
|
||||
Some(segments.join("::"))
|
||||
Some(segments.into_iter().join("::"))
|
||||
}
|
||||
|
||||
pub fn canonical_module_path(
|
||||
&self,
|
||||
db: &dyn HirDatabase,
|
||||
) -> Option<impl Iterator<Item = Module>> {
|
||||
self.module(db).map(|it| it.path_to_root(db).into_iter().rev())
|
||||
}
|
||||
|
||||
pub fn name(self, db: &dyn HirDatabase) -> Option<Name> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue