mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
fix buffer whitespace skip
This commit is contained in:
1 parent
8a543982fe
commit
4876a5ad90
1 file changed
+5
-5
@@ -228,6 +228,11 @@ impl FormatCode {
|
||||
let mut arg_count = 0usize;
|
||||
let mut codes = vec![];
|
||||
while chars.peek().is_some() {
|
||||
// Skip whitespace before repeat count or format char
|
||||
while let Some(b' ' | b'\t' | b'\n' | b'\r') = chars.peek() {
|
||||
chars.next();
|
||||
}
|
||||
|
||||
// determine repeat operator:
|
||||
let repeat = match chars.peek() {
|
||||
Some(b'0'..=b'9') => {
|
||||
@@ -246,11 +251,6 @@ impl FormatCode {
|
||||
_ => 1,
|
||||
};
|
||||
|
||||
// Skip whitespace (Python ignores whitespace in format strings)
|
||||
while let Some(b' ' | b'\t' | b'\n' | b'\r') = chars.peek() {
|
||||
chars.next();
|
||||
}
|
||||
|
||||
// determine format char:
|
||||
let c = match chars.next() {
|
||||
Some(c) => c,
|
||||
|
||||
Reference in new issue
Block a user