mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
Rewrite doctest runnables
Handle more cases in a generic way without copy-pasting code.
This commit is contained in:
parent
0da1532ef2
commit
c888f1de6f
2 changed files with 82 additions and 106 deletions
|
@ -117,25 +117,6 @@ impl NavigationTarget {
|
|||
)
|
||||
}
|
||||
|
||||
/// Allows `NavigationTarget` to be created from a `DocCommentsOwner` and a `NameOwner`
|
||||
pub(crate) fn from_doc_commented(
|
||||
db: &RootDatabase,
|
||||
named: InFile<&dyn ast::NameOwner>,
|
||||
node: InFile<&dyn ast::DocCommentsOwner>,
|
||||
) -> NavigationTarget {
|
||||
let name =
|
||||
named.value.name().map(|it| it.text().clone()).unwrap_or_else(|| SmolStr::new("_"));
|
||||
let frange = node.map(|it| it.syntax()).original_file_range(db);
|
||||
|
||||
NavigationTarget::from_syntax(
|
||||
frange.file_id,
|
||||
name,
|
||||
None,
|
||||
frange.range,
|
||||
node.value.syntax().kind(),
|
||||
)
|
||||
}
|
||||
|
||||
fn from_syntax(
|
||||
file_id: FileId,
|
||||
name: SmolStr,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue