mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-28 12:55:05 +00:00
Ruff 2024.2 style (#9639)
This commit is contained in:
parent
0293908b71
commit
a6f32ddc5e
47 changed files with 835 additions and 2362 deletions
|
@ -9,7 +9,6 @@ use crate::expression::is_expression_huggable;
|
|||
use crate::expression::parentheses::{empty_parenthesized, parenthesized, Parentheses};
|
||||
use crate::other::commas;
|
||||
use crate::prelude::*;
|
||||
use crate::preview::is_multiline_string_handling_enabled;
|
||||
use crate::string::AnyString;
|
||||
|
||||
#[derive(Default)]
|
||||
|
@ -238,10 +237,6 @@ fn is_huggable_string_argument(
|
|||
arguments: &Arguments,
|
||||
context: &PyFormatContext,
|
||||
) -> bool {
|
||||
if !is_multiline_string_handling_enabled(context) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if string.is_implicit_concatenated() || !string.is_multiline(context.source()) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ use ruff_text_size::Ranged;
|
|||
use crate::comments::{dangling_open_parenthesis_comments, trailing_comments};
|
||||
use crate::context::{FStringState, NodeLevel, WithFStringState, WithNodeLevel};
|
||||
use crate::prelude::*;
|
||||
use crate::preview::is_hex_codes_in_unicode_sequences_enabled;
|
||||
use crate::string::normalize_string;
|
||||
use crate::verbatim::verbatim_text;
|
||||
|
||||
|
@ -62,7 +61,6 @@ impl Format<PyFormatContext<'_>> for FormatFStringLiteralElement<'_> {
|
|||
0,
|
||||
self.context.quotes(),
|
||||
self.context.prefix(),
|
||||
is_hex_codes_in_unicode_sequences_enabled(f.context()),
|
||||
true,
|
||||
);
|
||||
match &normalized {
|
||||
|
|
|
@ -7,7 +7,6 @@ use crate::expression::parentheses::{
|
|||
is_expression_parenthesized, parenthesized, Parentheses, Parenthesize,
|
||||
};
|
||||
use crate::prelude::*;
|
||||
use crate::preview::is_wrap_multiple_context_managers_in_parens_enabled;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct FormatWithItem;
|
||||
|
@ -30,9 +29,7 @@ impl FormatNodeRule<WithItem> for FormatWithItem {
|
|||
);
|
||||
|
||||
// Remove the parentheses of the `with_items` if the with statement adds parentheses
|
||||
if f.context().node_level().is_parenthesized()
|
||||
&& is_wrap_multiple_context_managers_in_parens_enabled(f.context())
|
||||
{
|
||||
if f.context().node_level().is_parenthesized() {
|
||||
if is_parenthesized {
|
||||
// ...except if the with item is parenthesized, then use this with item as a preferred breaking point
|
||||
// or when it has comments, then parenthesize it to prevent comments from moving.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue