Skip to content

Commit

Permalink
Tweak right slice after split
Browse files Browse the repository at this point in the history
  • Loading branch information
zanieb committed Aug 16, 2023
1 parent 7df5e0f commit 4ca226b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions crates/ruff_python_literal/src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1078,9 +1078,9 @@ impl FormatString {
left.push(c);
continue;
}
let (_, right) = text.split_at(idx);
let (_, right) = text.split_at(idx + 1);
let format_part = FormatString::parse_part_in_brackets(&left)?;
return Ok((format_part, &right[1..]));
return Ok((format_part, &right));
} else {
left.push(c);
}
Expand Down Expand Up @@ -1478,6 +1478,10 @@ mod tests {
FormatSpec::parse("}"),
Err(FormatSpecError::InvalidFormatType)
);
assert_eq!(
FormatSpec::parse("{}}"),
Err(FormatSpecError::InvalidFormatType)
);
assert_eq!(
FormatSpec::parse("{{x}}"),
Err(FormatSpecError::InvalidPlaceholder(
Expand Down

0 comments on commit 4ca226b

Please sign in to comment.