mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 05:15:04 +00:00
Rename EnumVariant -> Variant
This commit is contained in:
parent
609680ef97
commit
1766aae145
32 changed files with 86 additions and 86 deletions
|
@ -53,7 +53,7 @@ impl ast::VisibilityOwner for Enum {}
|
|||
impl ast::GenericParamsOwner for Enum {}
|
||||
impl Enum {
|
||||
pub fn enum_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![enum]) }
|
||||
pub fn variant_list(&self) -> Option<EnumVariantList> { support::child(&self.syntax) }
|
||||
pub fn variant_list(&self) -> Option<VariantList> { support::child(&self.syntax) }
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct ExternBlock {
|
||||
|
@ -427,22 +427,22 @@ impl TupleField {
|
|||
pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct EnumVariantList {
|
||||
pub struct VariantList {
|
||||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
impl EnumVariantList {
|
||||
impl VariantList {
|
||||
pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
|
||||
pub fn variants(&self) -> AstChildren<EnumVariant> { support::children(&self.syntax) }
|
||||
pub fn variants(&self) -> AstChildren<Variant> { support::children(&self.syntax) }
|
||||
pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct EnumVariant {
|
||||
pub struct Variant {
|
||||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
impl ast::AttrsOwner for EnumVariant {}
|
||||
impl ast::NameOwner for EnumVariant {}
|
||||
impl ast::VisibilityOwner for EnumVariant {}
|
||||
impl EnumVariant {
|
||||
impl ast::AttrsOwner for Variant {}
|
||||
impl ast::NameOwner for Variant {}
|
||||
impl ast::VisibilityOwner for Variant {}
|
||||
impl Variant {
|
||||
pub fn field_list(&self) -> Option<FieldList> { support::child(&self.syntax) }
|
||||
pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
|
||||
pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
|
||||
|
@ -1806,8 +1806,8 @@ impl AstNode for TupleField {
|
|||
}
|
||||
fn syntax(&self) -> &SyntaxNode { &self.syntax }
|
||||
}
|
||||
impl AstNode for EnumVariantList {
|
||||
fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM_VARIANT_LIST }
|
||||
impl AstNode for VariantList {
|
||||
fn can_cast(kind: SyntaxKind) -> bool { kind == VARIANT_LIST }
|
||||
fn cast(syntax: SyntaxNode) -> Option<Self> {
|
||||
if Self::can_cast(syntax.kind()) {
|
||||
Some(Self { syntax })
|
||||
|
@ -1817,8 +1817,8 @@ impl AstNode for EnumVariantList {
|
|||
}
|
||||
fn syntax(&self) -> &SyntaxNode { &self.syntax }
|
||||
}
|
||||
impl AstNode for EnumVariant {
|
||||
fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM_VARIANT }
|
||||
impl AstNode for Variant {
|
||||
fn can_cast(kind: SyntaxKind) -> bool { kind == VARIANT }
|
||||
fn cast(syntax: SyntaxNode) -> Option<Self> {
|
||||
if Self::can_cast(syntax.kind()) {
|
||||
Some(Self { syntax })
|
||||
|
@ -3640,12 +3640,12 @@ impl std::fmt::Display for TupleField {
|
|||
std::fmt::Display::fmt(self.syntax(), f)
|
||||
}
|
||||
}
|
||||
impl std::fmt::Display for EnumVariantList {
|
||||
impl std::fmt::Display for VariantList {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
std::fmt::Display::fmt(self.syntax(), f)
|
||||
}
|
||||
}
|
||||
impl std::fmt::Display for EnumVariant {
|
||||
impl std::fmt::Display for Variant {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
std::fmt::Display::fmt(self.syntax(), f)
|
||||
}
|
||||
|
|
|
@ -247,7 +247,7 @@ impl ast::RecordFieldPat {
|
|||
}
|
||||
}
|
||||
|
||||
impl ast::EnumVariant {
|
||||
impl ast::Variant {
|
||||
pub fn parent_enum(&self) -> ast::Enum {
|
||||
self.syntax()
|
||||
.parent()
|
||||
|
@ -480,7 +480,7 @@ impl ast::DocCommentsOwner for ast::Union {}
|
|||
impl ast::DocCommentsOwner for ast::RecordField {}
|
||||
impl ast::DocCommentsOwner for ast::TupleField {}
|
||||
impl ast::DocCommentsOwner for ast::Enum {}
|
||||
impl ast::DocCommentsOwner for ast::EnumVariant {}
|
||||
impl ast::DocCommentsOwner for ast::Variant {}
|
||||
impl ast::DocCommentsOwner for ast::TraitDef {}
|
||||
impl ast::DocCommentsOwner for ast::Module {}
|
||||
impl ast::DocCommentsOwner for ast::StaticDef {}
|
||||
|
|
|
@ -146,7 +146,7 @@ fn n_attached_trivias<'a>(
|
|||
trivias: impl Iterator<Item = (SyntaxKind, &'a str)>,
|
||||
) -> usize {
|
||||
match kind {
|
||||
MACRO_CALL | CONST_DEF | TYPE_ALIAS | STRUCT | ENUM | ENUM_VARIANT | FN | TRAIT_DEF
|
||||
MACRO_CALL | CONST_DEF | TYPE_ALIAS | STRUCT | ENUM | VARIANT | FN | TRAIT_DEF
|
||||
| MODULE | RECORD_FIELD | STATIC_DEF => {
|
||||
let mut res = 0;
|
||||
let mut trivias = trivias.enumerate().peekable();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue