Remove deprecated string interpolation syntax

This commit is contained in:
hrishisd 2024-10-08 16:31:22 -04:00
parent 72011fba73
commit cb98c45e88
No known key found for this signature in database
GPG key ID: E447B3759263B767
15 changed files with 17 additions and 94 deletions

View file

@ -281,11 +281,10 @@ pub struct WhenPattern<'a> {
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum StrSegment<'a> {
Plaintext(&'a str), // e.g. "foo"
Unicode(Loc<&'a str>), // e.g. "00A0" in "\u(00A0)"
EscapedChar(EscapedChar), // e.g. '\n' in "Hello!\n"
Interpolated(Loc<&'a Expr<'a>>),
DeprecatedInterpolated(Loc<&'a Expr<'a>>), // The old "$(...)" syntax - will be removed someday
Plaintext(&'a str), // e.g. "foo"
Unicode(Loc<&'a str>), // e.g. "00A0" in "\u(00A0)"
EscapedChar(EscapedChar), // e.g. '\n' in "Hello!\n"
Interpolated(Loc<&'a Expr<'a>>), // e.g. "$(expr)"
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
@ -379,7 +378,6 @@ impl<'a> TryFrom<StrSegment<'a>> for SingleQuoteSegment<'a> {
StrSegment::Unicode(s) => Ok(SingleQuoteSegment::Unicode(s)),
StrSegment::EscapedChar(s) => Ok(SingleQuoteSegment::EscapedChar(s)),
StrSegment::Interpolated(_) => Err(ESingleQuote::InterpolationNotAllowed),
StrSegment::DeprecatedInterpolated(_) => Err(ESingleQuote::InterpolationNotAllowed),
}
}
}
@ -2516,9 +2514,7 @@ impl<'a> Malformed for StrSegment<'a> {
fn is_malformed(&self) -> bool {
match self {
StrSegment::Plaintext(_) | StrSegment::Unicode(_) | StrSegment::EscapedChar(_) => false,
StrSegment::Interpolated(expr) | StrSegment::DeprecatedInterpolated(expr) => {
expr.is_malformed()
}
StrSegment::Interpolated(expr) => expr.is_malformed(),
}
}
}