Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/syntax/src/ast/node_ext.rs')
-rw-r--r--crates/syntax/src/ast/node_ext.rs41
1 files changed, 1 insertions, 40 deletions
diff --git a/crates/syntax/src/ast/node_ext.rs b/crates/syntax/src/ast/node_ext.rs
index 99ef5c264f..930e5ce74f 100644
--- a/crates/syntax/src/ast/node_ext.rs
+++ b/crates/syntax/src/ast/node_ext.rs
@@ -167,36 +167,6 @@ impl NameOwner for Macro {
impl AttrsOwner for Macro {}
-/// Basically an owned `dyn AttrsOwner` without extra boxing.
-pub struct AttrsOwnerNode {
- node: SyntaxNode,
-}
-
-impl AttrsOwnerNode {
- pub fn new<N: AttrsOwner>(node: N) -> Self {
- AttrsOwnerNode { node: node.syntax().clone() }
- }
-}
-
-impl AttrsOwner for AttrsOwnerNode {}
-impl AstNode for AttrsOwnerNode {
- fn can_cast(_: SyntaxKind) -> bool
- where
- Self: Sized,
- {
- false
- }
- fn cast(_: SyntaxNode) -> Option<Self>
- where
- Self: Sized,
- {
- None
- }
- fn syntax(&self) -> &SyntaxNode {
- &self.node
- }
-}
-
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum AttrKind {
Inner,
@@ -602,16 +572,7 @@ impl ast::Variant {
impl ast::Item {
pub fn generic_param_list(&self) -> Option<ast::GenericParamList> {
- match self {
- ast::Item::Enum(it) => it.generic_param_list(),
- ast::Item::Fn(it) => it.generic_param_list(),
- ast::Item::Impl(it) => it.generic_param_list(),
- ast::Item::Struct(it) => it.generic_param_list(),
- ast::Item::Trait(it) => it.generic_param_list(),
- ast::Item::TypeAlias(it) => it.generic_param_list(),
- ast::Item::Union(it) => it.generic_param_list(),
- _ => None,
- }
+ ast::DynGenericParamsOwner::cast(self.syntax().clone())?.generic_param_list()
}
}