Remove unused f-string error type (#6941)

This commit is contained in:
Dhruv Manilawala 2023-08-28 18:34:48 +05:30 committed by GitHub
parent 60097bebcd
commit 2893a9f6b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -717,10 +717,6 @@ impl From<FStringError> for LexicalError {
pub enum FStringErrorType {
/// Expected a right brace after an opened left brace.
UnclosedLbrace,
/// Expected a left brace after an ending right brace.
UnopenedRbrace,
/// Expected a right brace after a conversion flag.
ExpectedRbrace,
/// An error occurred while parsing an f-string expression.
InvalidExpression(Box<ParseErrorType>),
/// An invalid conversion flag was encountered.
@ -745,14 +741,12 @@ pub enum FStringErrorType {
impl std::fmt::Display for FStringErrorType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
use FStringErrorType::{
EmptyExpression, ExpectedRbrace, ExpressionCannotInclude, ExpressionNestedTooDeeply,
EmptyExpression, ExpressionCannotInclude, ExpressionNestedTooDeeply,
InvalidConversionFlag, InvalidExpression, MismatchedDelimiter, SingleRbrace,
UnclosedLbrace, Unmatched, UnopenedRbrace, UnterminatedString,
UnclosedLbrace, Unmatched, UnterminatedString,
};
match self {
UnclosedLbrace => write!(f, "expecting '}}'"),
UnopenedRbrace => write!(f, "Unopened '}}'"),
ExpectedRbrace => write!(f, "Expected '}}' after conversion flag."),
InvalidExpression(error) => {
write!(f, "{error}")
}