mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 21:13:37 +00:00
Provide impl From<ast::TypeOrConstParam> for ast::GenericParam
This commit is contained in:
parent
ddbb28daa0
commit
5c59a718c5
1 changed files with 10 additions and 1 deletions
|
@ -17,7 +17,7 @@ use crate::{
|
|||
ted, NodeOrToken, SmolStr, SyntaxElement, SyntaxToken, TokenText, T,
|
||||
};
|
||||
|
||||
use super::{RangeItem, RangeOp};
|
||||
use super::{GenericParam, RangeItem, RangeOp};
|
||||
|
||||
impl ast::Lifetime {
|
||||
pub fn text(&self) -> TokenText<'_> {
|
||||
|
@ -822,6 +822,15 @@ pub enum TypeOrConstParam {
|
|||
Const(ast::ConstParam),
|
||||
}
|
||||
|
||||
impl From<TypeOrConstParam> for GenericParam {
|
||||
fn from(value: TypeOrConstParam) -> Self {
|
||||
match value {
|
||||
TypeOrConstParam::Type(it) => GenericParam::TypeParam(it),
|
||||
TypeOrConstParam::Const(it) => GenericParam::ConstParam(it),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl TypeOrConstParam {
|
||||
pub fn name(&self) -> Option<ast::Name> {
|
||||
match self {
|
||||
|
|
Loading…
Reference in a new issue