Fix build_format
not unescaping braces properly
Co-authored-by: RanolP <public.ranolp@gmail.com>
This commit is contained in:
parent
b28cc097cf
commit
8ed8aac3ca
1 changed files with 32 additions and 27 deletions
|
@ -235,7 +235,13 @@ pub(crate) trait HasFieldMap {
|
|||
// the referenced fields. Leaves `it` sitting on the closing brace of the format string, so
|
||||
// the next call to `it.next()` retrieves the next character.
|
||||
while let Some(c) = it.next() {
|
||||
if c == '{' && *it.peek().unwrap_or(&'\0') != '{' {
|
||||
if c != '{' {
|
||||
continue;
|
||||
}
|
||||
if *it.peek().unwrap_or(&'\0') == '{' {
|
||||
assert_eq!(it.next().unwrap(), '{');
|
||||
continue;
|
||||
}
|
||||
let mut eat_argument = || -> Option<String> {
|
||||
let mut result = String::new();
|
||||
// Format specifiers look like:
|
||||
|
@ -265,7 +271,6 @@ pub(crate) trait HasFieldMap {
|
|||
referenced_fields.insert(referenced_field);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// At this point, `referenced_fields` contains a set of the unique fields that were
|
||||
// referenced in the format string. Generate the corresponding "x = self.x" format
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue