Skip to content

Commit 096a604

Browse files
authored
Merge pull request RustPython#4415 from harupy/remove-incorrect-empty-expression-error
Remove incorrect `EmptyExpression` in `StringParser.parse_formatted_value`
2 parents 478aa41 + 60ce07d commit 096a604

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

compiler/parser/src/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ impl fmt::Display for LexicalErrorType {
4242
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
4343
match self {
4444
LexicalErrorType::StringError => write!(f, "Got unexpected string"),
45-
LexicalErrorType::FStringError(error) => write!(f, "Got error in f-string: {error}"),
45+
LexicalErrorType::FStringError(error) => write!(f, "f-string: {error}"),
4646
LexicalErrorType::UnicodeError => write!(f, "Got unexpected unicode"),
4747
LexicalErrorType::NestingError => write!(f, "Got unexpected nesting"),
4848
LexicalErrorType::IndentationError => {

compiler/parser/src/string_parser.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -358,11 +358,7 @@ impl<'a> StringParser<'a> {
358358
}
359359
}
360360
}
361-
Err(if expression.trim().is_empty() {
362-
FStringError::new(EmptyExpression, self.get_pos()).into()
363-
} else {
364-
FStringError::new(UnclosedLbrace, self.get_pos()).into()
365-
})
361+
Err(FStringError::new(UnclosedLbrace, self.get_pos()).into())
366362
}
367363

368364
fn parse_spec(&mut self, nested: u8) -> Result<Vec<Expr>, LexicalError> {

0 commit comments

Comments
 (0)