mirror of
https://github.com/RustPython/Parser.git
synced 2025-07-12 23:55:21 +00:00
Simplify code using match
This commit is contained in:
parent
33fd321fad
commit
383ad672e7
1 changed files with 5 additions and 5 deletions
|
@ -226,12 +226,12 @@ impl<'a> StringParser<'a> {
|
|||
}
|
||||
};
|
||||
|
||||
if let Some(&peek) = self.peek() {
|
||||
if peek != '}' && peek != ':' {
|
||||
return Err(UnclosedLbrace.to_lexical_error(self.get_pos()));
|
||||
match self.peek() {
|
||||
Some('}' | ':') => {}
|
||||
Some(_) => {
|
||||
return Err(InvalidConversionFlag.to_lexical_error(self.get_pos()))
|
||||
}
|
||||
} else {
|
||||
return Err(UnclosedLbrace.to_lexical_error(self.get_pos()));
|
||||
None => return Err(UnclosedLbrace.to_lexical_error(self.get_pos())),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue