mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-16 16:40:19 +00:00
Format bytes string (#6166)
<!-- Thank you for contributing to Ruff! To help us out with reviewing, please consider the following: - Does this pull request include a summary of the change? (See below.) - Does this pull request include a descriptive title? - Does this pull request include references to any relevant issues? --> ## Summary Format bytes string Closes #6064 ## Test Plan Added a fixture based on string's one
This commit is contained in:
parent
de898c52eb
commit
b95fc6d162
9 changed files with 577 additions and 89 deletions
|
@ -31,7 +31,7 @@ pub enum StringLayout {
|
|||
|
||||
impl<'a> FormatString<'a> {
|
||||
pub(super) fn new(constant: &'a ExprConstant) -> Self {
|
||||
debug_assert!(constant.value.is_str());
|
||||
debug_assert!(constant.value.is_str() || constant.value.is_bytes());
|
||||
Self {
|
||||
constant,
|
||||
layout: StringLayout::Default,
|
||||
|
@ -70,7 +70,7 @@ struct FormatStringContinuation<'a> {
|
|||
|
||||
impl<'a> FormatStringContinuation<'a> {
|
||||
fn new(constant: &'a ExprConstant) -> Self {
|
||||
debug_assert!(constant.value.is_str());
|
||||
debug_assert!(constant.value.is_str() || constant.value.is_bytes());
|
||||
Self { constant }
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue