diff --git a/crates/ruff_python_formatter/src/context.rs b/crates/ruff_python_formatter/src/context.rs index 03d752ec964b0..e8d5d71fac3ba 100644 --- a/crates/ruff_python_formatter/src/context.rs +++ b/crates/ruff_python_formatter/src/context.rs @@ -108,18 +108,6 @@ impl<'a> PyFormatContext<'a> { self.f_string_state = f_string_state; } - /// Return a new context suitable for formatting an expression inside an - /// f-string. - /// - /// The `quotes` parameter should be the quote information of the f-string - /// containing the expression. - pub(crate) fn in_f_string(self, quotes: StringQuotes) -> PyFormatContext<'a> { - PyFormatContext { - f_string_state: FStringState::Inside(quotes), - ..self - } - } - /// Returns a new context with the given set of options. pub(crate) fn with_options(mut self, options: PyFormatOptions) -> Self { self.options = options; diff --git a/crates/ruff_python_formatter/src/other/f_string_element.rs b/crates/ruff_python_formatter/src/other/f_string_element.rs index 0d477fe020ce4..2ffb56d695a00 100644 --- a/crates/ruff_python_formatter/src/other/f_string_element.rs +++ b/crates/ruff_python_formatter/src/other/f_string_element.rs @@ -190,11 +190,7 @@ impl Format> for FormatFStringExpressionElement<'_> { .clone() .with_line_width(NonZeroU16::MAX.into()) .with_magic_trailing_comma(MagicTrailingComma::Ignore); - let context = f - .context() - .clone() - .in_f_string(self.context.quotes()) - .with_options(options); + let context = f.context().clone().with_options(options); let formatted = crate::format!(context, [expression.format()])?; text(formatted.print()?.as_code()).fmt(f)?; } else {