From c26a5f57e4ea2857b147481c82dd9d336f69ab39 Mon Sep 17 00:00:00 2001 From: Micha Reiser Date: Tue, 22 Oct 2024 18:06:38 +0200 Subject: [PATCH] Clippy --- crates/ruff_python_formatter/src/string/implicit.rs | 3 +-- .../ruff_python_formatter/src/string/normalize.rs | 13 +++++-------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/crates/ruff_python_formatter/src/string/implicit.rs b/crates/ruff_python_formatter/src/string/implicit.rs index db59fe5cdf411f..329738654d12f3 100644 --- a/crates/ruff_python_formatter/src/string/implicit.rs +++ b/crates/ruff_python_formatter/src/string/implicit.rs @@ -196,9 +196,8 @@ impl<'a> FormatImplicitConcatenatedStringFlat<'a> { .is_some_and(|quote| quote != part.flags().quote_style()) { return None; - } else { - preserve_quotes_requirement = Some(part.flags().quote_style()); } + preserve_quotes_requirement = Some(part.flags().quote_style()); } } } diff --git a/crates/ruff_python_formatter/src/string/normalize.rs b/crates/ruff_python_formatter/src/string/normalize.rs index b06125df3290e9..b1470fbf54ff3a 100644 --- a/crates/ruff_python_formatter/src/string/normalize.rs +++ b/crates/ruff_python_formatter/src/string/normalize.rs @@ -3,18 +3,17 @@ use std::cmp::Ordering; use std::iter::FusedIterator; use ruff_formatter::FormatContext; +use ruff_python_ast::visitor::source_order::SourceOrderVisitor; use ruff_python_ast::{ - AnyStringFlags, BytesLiteral, FString, str::Quote, StringFlags, StringLikePart, - StringLiteral, + str::Quote, AnyStringFlags, BytesLiteral, FString, StringFlags, StringLikePart, StringLiteral, }; -use ruff_python_ast::visitor::source_order::SourceOrderVisitor; use ruff_text_size::{Ranged, TextRange}; use crate::context::FStringState; use crate::prelude::*; use crate::preview::is_f_string_formatting_enabled; -use crate::QuoteStyle; use crate::string::{Quoting, StringQuotes}; +use crate::QuoteStyle; pub(crate) struct StringNormalizer<'a, 'src> { quoting: Quoting, @@ -1005,17 +1004,15 @@ pub(super) fn is_fstring_with_triple_quoted_literal_expression_containing_quotes mod tests { use std::borrow::Cow; + use ruff_python_ast::str_prefix::FStringPrefix; use ruff_python_ast::{ - AnyStringFlags, str::Quote, str_prefix::{AnyStringPrefix, ByteStringPrefix}, + AnyStringFlags, }; - use ruff_python_ast::str_prefix::FStringPrefix; - use crate::string::normalize_string; use crate::string::normalize_string; - use super::UnicodeEscape; use super::UnicodeEscape; #[test]