mirror of
https://github.com/RustPython/Parser.git
synced 2025-07-13 08:05:17 +00:00
Simplify code using match
This commit is contained in:
parent
68586f8e3c
commit
fac6a857f6
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