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 c4dafba commit b719975
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 @@ -659,9 +659,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 @@ -961,6 +961,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 b719975

Please sign in to comment.