mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
Kill RAW_ literals
Syntactically, they are indistinguishable from non-raw versions, so it doesn't make sense to separate then *at the syntax* level.
This commit is contained in:
parent
6725dcf847
commit
5ba4f949c2
53 changed files with 142 additions and 165 deletions
|
@ -70,16 +70,16 @@ impl AstToken for String {
|
|||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct RawString {
|
||||
pub struct ByteString {
|
||||
pub(crate) syntax: SyntaxToken,
|
||||
}
|
||||
impl std::fmt::Display for RawString {
|
||||
impl std::fmt::Display for ByteString {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
std::fmt::Display::fmt(&self.syntax, f)
|
||||
}
|
||||
}
|
||||
impl AstToken for RawString {
|
||||
fn can_cast(kind: SyntaxKind) -> bool { kind == RAW_STRING }
|
||||
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 })
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue