mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-12-23 08:48:08 +00:00
Merge pull request #20902 from krobelus/support-rustfmt-again
Fix rustfmt for files that use 2024-edition syntax
This commit is contained in:
commit
b4de9df2cd
3 changed files with 167 additions and 822 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -1,9 +1,9 @@
|
|||
//! Generated by `cargo xtask codegen grammar`, do not edit by hand.
|
||||
|
||||
use crate::{
|
||||
ast::AstToken,
|
||||
SyntaxKind::{self, *},
|
||||
SyntaxToken,
|
||||
ast::AstToken,
|
||||
};
|
||||
use std::{fmt, hash};
|
||||
pub struct Byte {
|
||||
|
|
@ -17,11 +17,7 @@ impl std::fmt::Display for Byte {
|
|||
impl AstToken for Byte {
|
||||
fn can_cast(kind: SyntaxKind) -> bool { kind == BYTE }
|
||||
fn cast(syntax: SyntaxToken) -> Option<Self> {
|
||||
if Self::can_cast(syntax.kind()) {
|
||||
Some(Self { syntax })
|
||||
} else {
|
||||
None
|
||||
}
|
||||
if Self::can_cast(syntax.kind()) { Some(Self { syntax }) } else { None }
|
||||
}
|
||||
fn syntax(&self) -> &SyntaxToken { &self.syntax }
|
||||
}
|
||||
|
|
@ -51,11 +47,7 @@ impl std::fmt::Display for ByteString {
|
|||
impl AstToken for ByteString {
|
||||
fn can_cast(kind: SyntaxKind) -> bool { kind == BYTE_STRING }
|
||||
fn cast(syntax: SyntaxToken) -> Option<Self> {
|
||||
if Self::can_cast(syntax.kind()) {
|
||||
Some(Self { syntax })
|
||||
} else {
|
||||
None
|
||||
}
|
||||
if Self::can_cast(syntax.kind()) { Some(Self { syntax }) } else { None }
|
||||
}
|
||||
fn syntax(&self) -> &SyntaxToken { &self.syntax }
|
||||
}
|
||||
|
|
@ -85,11 +77,7 @@ impl std::fmt::Display for CString {
|
|||
impl AstToken for CString {
|
||||
fn can_cast(kind: SyntaxKind) -> bool { kind == C_STRING }
|
||||
fn cast(syntax: SyntaxToken) -> Option<Self> {
|
||||
if Self::can_cast(syntax.kind()) {
|
||||
Some(Self { syntax })
|
||||
} else {
|
||||
None
|
||||
}
|
||||
if Self::can_cast(syntax.kind()) { Some(Self { syntax }) } else { None }
|
||||
}
|
||||
fn syntax(&self) -> &SyntaxToken { &self.syntax }
|
||||
}
|
||||
|
|
@ -119,11 +107,7 @@ impl std::fmt::Display for Char {
|
|||
impl AstToken for Char {
|
||||
fn can_cast(kind: SyntaxKind) -> bool { kind == CHAR }
|
||||
fn cast(syntax: SyntaxToken) -> Option<Self> {
|
||||
if Self::can_cast(syntax.kind()) {
|
||||
Some(Self { syntax })
|
||||
} else {
|
||||
None
|
||||
}
|
||||
if Self::can_cast(syntax.kind()) { Some(Self { syntax }) } else { None }
|
||||
}
|
||||
fn syntax(&self) -> &SyntaxToken { &self.syntax }
|
||||
}
|
||||
|
|
@ -153,11 +137,7 @@ impl std::fmt::Display for Comment {
|
|||
impl AstToken for Comment {
|
||||
fn can_cast(kind: SyntaxKind) -> bool { kind == COMMENT }
|
||||
fn cast(syntax: SyntaxToken) -> Option<Self> {
|
||||
if Self::can_cast(syntax.kind()) {
|
||||
Some(Self { syntax })
|
||||
} else {
|
||||
None
|
||||
}
|
||||
if Self::can_cast(syntax.kind()) { Some(Self { syntax }) } else { None }
|
||||
}
|
||||
fn syntax(&self) -> &SyntaxToken { &self.syntax }
|
||||
}
|
||||
|
|
@ -187,11 +167,7 @@ impl std::fmt::Display for FloatNumber {
|
|||
impl AstToken for FloatNumber {
|
||||
fn can_cast(kind: SyntaxKind) -> bool { kind == FLOAT_NUMBER }
|
||||
fn cast(syntax: SyntaxToken) -> Option<Self> {
|
||||
if Self::can_cast(syntax.kind()) {
|
||||
Some(Self { syntax })
|
||||
} else {
|
||||
None
|
||||
}
|
||||
if Self::can_cast(syntax.kind()) { Some(Self { syntax }) } else { None }
|
||||
}
|
||||
fn syntax(&self) -> &SyntaxToken { &self.syntax }
|
||||
}
|
||||
|
|
@ -221,11 +197,7 @@ impl std::fmt::Display for Ident {
|
|||
impl AstToken for Ident {
|
||||
fn can_cast(kind: SyntaxKind) -> bool { kind == IDENT }
|
||||
fn cast(syntax: SyntaxToken) -> Option<Self> {
|
||||
if Self::can_cast(syntax.kind()) {
|
||||
Some(Self { syntax })
|
||||
} else {
|
||||
None
|
||||
}
|
||||
if Self::can_cast(syntax.kind()) { Some(Self { syntax }) } else { None }
|
||||
}
|
||||
fn syntax(&self) -> &SyntaxToken { &self.syntax }
|
||||
}
|
||||
|
|
@ -255,11 +227,7 @@ impl std::fmt::Display for IntNumber {
|
|||
impl AstToken for IntNumber {
|
||||
fn can_cast(kind: SyntaxKind) -> bool { kind == INT_NUMBER }
|
||||
fn cast(syntax: SyntaxToken) -> Option<Self> {
|
||||
if Self::can_cast(syntax.kind()) {
|
||||
Some(Self { syntax })
|
||||
} else {
|
||||
None
|
||||
}
|
||||
if Self::can_cast(syntax.kind()) { Some(Self { syntax }) } else { None }
|
||||
}
|
||||
fn syntax(&self) -> &SyntaxToken { &self.syntax }
|
||||
}
|
||||
|
|
@ -289,11 +257,7 @@ impl std::fmt::Display for String {
|
|||
impl AstToken for String {
|
||||
fn can_cast(kind: SyntaxKind) -> bool { kind == STRING }
|
||||
fn cast(syntax: SyntaxToken) -> Option<Self> {
|
||||
if Self::can_cast(syntax.kind()) {
|
||||
Some(Self { syntax })
|
||||
} else {
|
||||
None
|
||||
}
|
||||
if Self::can_cast(syntax.kind()) { Some(Self { syntax }) } else { None }
|
||||
}
|
||||
fn syntax(&self) -> &SyntaxToken { &self.syntax }
|
||||
}
|
||||
|
|
@ -323,11 +287,7 @@ impl std::fmt::Display for Whitespace {
|
|||
impl AstToken for Whitespace {
|
||||
fn can_cast(kind: SyntaxKind) -> bool { kind == WHITESPACE }
|
||||
fn cast(syntax: SyntaxToken) -> Option<Self> {
|
||||
if Self::can_cast(syntax.kind()) {
|
||||
Some(Self { syntax })
|
||||
} else {
|
||||
None
|
||||
}
|
||||
if Self::can_cast(syntax.kind()) { Some(Self { syntax }) } else { None }
|
||||
}
|
||||
fn syntax(&self) -> &SyntaxToken { &self.syntax }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,2 +1,3 @@
|
|||
edition = "2024"
|
||||
reorder_modules = true
|
||||
use_small_heuristics = "Max"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue