mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-25 20:43:21 +00:00
Merge #5570
5570: Dead code r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
commit
525ae706b3
2 changed files with 0 additions and 49 deletions
|
@ -1710,7 +1710,6 @@ pub struct RecordFieldPatList {
|
|||
}
|
||||
impl RecordFieldPatList {
|
||||
pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
|
||||
pub fn pats(&self) -> AstChildren<RecordInnerPat> { support::children(&self.syntax) }
|
||||
pub fn record_field_pats(&self) -> AstChildren<RecordFieldPat> {
|
||||
support::children(&self.syntax)
|
||||
}
|
||||
|
@ -2721,13 +2720,6 @@ pub enum Pat {
|
|||
LiteralPat(LiteralPat),
|
||||
MacroPat(MacroPat),
|
||||
}
|
||||
/// Any kind of pattern that appears directly inside of the curly
|
||||
/// braces of a record pattern
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub enum RecordInnerPat {
|
||||
RecordFieldPat(RecordFieldPat),
|
||||
BindPat(BindPat),
|
||||
}
|
||||
/// Any kind of input to an attribute
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub enum AttrInput {
|
||||
|
@ -4693,34 +4685,6 @@ impl AstNode for Pat {
|
|||
}
|
||||
}
|
||||
}
|
||||
impl From<RecordFieldPat> for RecordInnerPat {
|
||||
fn from(node: RecordFieldPat) -> RecordInnerPat { RecordInnerPat::RecordFieldPat(node) }
|
||||
}
|
||||
impl From<BindPat> for RecordInnerPat {
|
||||
fn from(node: BindPat) -> RecordInnerPat { RecordInnerPat::BindPat(node) }
|
||||
}
|
||||
impl AstNode for RecordInnerPat {
|
||||
fn can_cast(kind: SyntaxKind) -> bool {
|
||||
match kind {
|
||||
RECORD_FIELD_PAT | BIND_PAT => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
fn cast(syntax: SyntaxNode) -> Option<Self> {
|
||||
let res = match syntax.kind() {
|
||||
RECORD_FIELD_PAT => RecordInnerPat::RecordFieldPat(RecordFieldPat { syntax }),
|
||||
BIND_PAT => RecordInnerPat::BindPat(BindPat { syntax }),
|
||||
_ => return None,
|
||||
};
|
||||
Some(res)
|
||||
}
|
||||
fn syntax(&self) -> &SyntaxNode {
|
||||
match self {
|
||||
RecordInnerPat::RecordFieldPat(it) => &it.syntax,
|
||||
RecordInnerPat::BindPat(it) => &it.syntax,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl From<Literal> for AttrInput {
|
||||
fn from(node: Literal) -> AttrInput { AttrInput::Literal(node) }
|
||||
}
|
||||
|
@ -4847,11 +4811,6 @@ impl std::fmt::Display for Pat {
|
|||
std::fmt::Display::fmt(self.syntax(), f)
|
||||
}
|
||||
}
|
||||
impl std::fmt::Display for RecordInnerPat {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
std::fmt::Display::fmt(self.syntax(), f)
|
||||
}
|
||||
}
|
||||
impl std::fmt::Display for AttrInput {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
std::fmt::Display::fmt(self.syntax(), f)
|
||||
|
|
|
@ -1479,7 +1479,6 @@ pub(crate) fn rust_ast() -> AstSrc {
|
|||
/// [Reference](https://doc.rust-lang.org/reference/patterns.html#struct-patterns)
|
||||
struct RecordFieldPatList {
|
||||
T!['{'],
|
||||
pats: [RecordInnerPat],
|
||||
record_field_pats: [RecordFieldPat],
|
||||
bind_pats: [BindPat],
|
||||
T![..],
|
||||
|
@ -2213,13 +2212,6 @@ pub(crate) fn rust_ast() -> AstSrc {
|
|||
MacroPat,
|
||||
}
|
||||
|
||||
/// Any kind of pattern that appears directly inside of the curly
|
||||
/// braces of a record pattern
|
||||
enum RecordInnerPat {
|
||||
RecordFieldPat,
|
||||
BindPat
|
||||
}
|
||||
|
||||
/// Any kind of input to an attribute
|
||||
enum AttrInput { Literal, TokenTree }
|
||||
|
||||
|
|
Loading…
Reference in a new issue