mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
Move AttrsOwnerNode
to syntax and make it public
This commit is contained in:
parent
fc21640a65
commit
fc5f73de45
3 changed files with 33 additions and 33 deletions
|
@ -6,7 +6,7 @@ use either::Either;
|
|||
use hir::{HasAttrs, InFile, Semantics};
|
||||
use ide_db::{call_info::ActiveParameter, defs::Definition, SymbolKind};
|
||||
use syntax::{
|
||||
ast::{self, AstNode, AttrsOwner, DocCommentsOwner},
|
||||
ast::{self, AstNode, AttrsOwner, AttrsOwnerNode, DocCommentsOwner},
|
||||
match_ast, AstToken, NodeOrToken, SyntaxNode, SyntaxToken, TextRange, TextSize,
|
||||
};
|
||||
|
||||
|
@ -89,36 +89,6 @@ const RUSTDOC_FENCE_TOKENS: &[&'static str] = &[
|
|||
"edition2021",
|
||||
];
|
||||
|
||||
// Basically an owned dyn AttrsOwner without extra Boxing
|
||||
struct AttrsOwnerNode {
|
||||
node: SyntaxNode,
|
||||
}
|
||||
|
||||
impl AttrsOwnerNode {
|
||||
fn new<N: DocCommentsOwner>(node: N) -> Self {
|
||||
AttrsOwnerNode { node: node.syntax().clone() }
|
||||
}
|
||||
}
|
||||
|
||||
impl AttrsOwner for AttrsOwnerNode {}
|
||||
impl AstNode for AttrsOwnerNode {
|
||||
fn can_cast(_: syntax::SyntaxKind) -> bool
|
||||
where
|
||||
Self: Sized,
|
||||
{
|
||||
false
|
||||
}
|
||||
fn cast(_: SyntaxNode) -> Option<Self>
|
||||
where
|
||||
Self: Sized,
|
||||
{
|
||||
None
|
||||
}
|
||||
fn syntax(&self) -> &SyntaxNode {
|
||||
&self.node
|
||||
}
|
||||
}
|
||||
|
||||
fn doc_attributes<'node>(
|
||||
sema: &Semantics<RootDatabase>,
|
||||
node: &'node SyntaxNode,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue