mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-16 01:25:22 +00:00
Switch to Rust 2024 edition (#18129)
This commit is contained in:
parent
e67b35743a
commit
9ae698fe30
1082 changed files with 4211 additions and 3300 deletions
|
@ -3,7 +3,7 @@ use ruff_python_ast::{AnyNodeRef, Expr};
|
|||
use ruff_python_ast::{MatchCase, Pattern};
|
||||
use ruff_python_trivia::CommentRanges;
|
||||
use ruff_python_trivia::{
|
||||
first_non_trivia_token, BackwardsTokenizer, SimpleToken, SimpleTokenKind,
|
||||
BackwardsTokenizer, SimpleToken, SimpleTokenKind, first_non_trivia_token,
|
||||
};
|
||||
use ruff_text_size::Ranged;
|
||||
use std::cmp::Ordering;
|
||||
|
@ -11,7 +11,7 @@ use std::cmp::Ordering;
|
|||
use crate::builders::parenthesize_if_expands;
|
||||
use crate::context::{NodeLevel, WithNodeLevel};
|
||||
use crate::expression::parentheses::{
|
||||
optional_parentheses, parenthesized, NeedsParentheses, OptionalParentheses, Parentheses,
|
||||
NeedsParentheses, OptionalParentheses, Parentheses, optional_parentheses, parenthesized,
|
||||
};
|
||||
use crate::prelude::*;
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ use ruff_python_ast::{Pattern, PatternArguments};
|
|||
use ruff_python_trivia::{SimpleTokenKind, SimpleTokenizer};
|
||||
use ruff_text_size::{Ranged, TextRange, TextSize};
|
||||
|
||||
use crate::expression::parentheses::{empty_parenthesized, parenthesized, Parentheses};
|
||||
use crate::expression::parentheses::{Parentheses, empty_parenthesized, parenthesized};
|
||||
use crate::prelude::*;
|
||||
|
||||
#[derive(Default)]
|
||||
|
|
|
@ -5,9 +5,9 @@ use ruff_python_ast::{Expr, Identifier, Pattern};
|
|||
use ruff_python_trivia::{SimpleTokenKind, SimpleTokenizer};
|
||||
use ruff_text_size::{Ranged, TextRange};
|
||||
|
||||
use crate::comments::{leading_comments, trailing_comments, SourceComment};
|
||||
use crate::comments::{SourceComment, leading_comments, trailing_comments};
|
||||
use crate::expression::parentheses::{
|
||||
empty_parenthesized, parenthesized, NeedsParentheses, OptionalParentheses,
|
||||
NeedsParentheses, OptionalParentheses, empty_parenthesized, parenthesized,
|
||||
};
|
||||
use crate::prelude::*;
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ use ruff_python_ast::PatternMatchOr;
|
|||
|
||||
use crate::comments::leading_comments;
|
||||
use crate::expression::parentheses::{
|
||||
in_parentheses_only_group, in_parentheses_only_soft_line_break_or_space, NeedsParentheses,
|
||||
OptionalParentheses,
|
||||
NeedsParentheses, OptionalParentheses, in_parentheses_only_group,
|
||||
in_parentheses_only_soft_line_break_or_space,
|
||||
};
|
||||
use crate::prelude::*;
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
use ruff_formatter::{format_args, Format, FormatResult};
|
||||
use ruff_formatter::{Format, FormatResult, format_args};
|
||||
use ruff_python_ast::AnyNodeRef;
|
||||
use ruff_python_ast::PatternMatchSequence;
|
||||
use ruff_python_trivia::{SimpleTokenKind, SimpleTokenizer};
|
||||
use ruff_text_size::{Ranged, TextRange};
|
||||
|
||||
use crate::expression::parentheses::{
|
||||
empty_parenthesized, optional_parentheses, parenthesized, NeedsParentheses, OptionalParentheses,
|
||||
NeedsParentheses, OptionalParentheses, empty_parenthesized, optional_parentheses, parenthesized,
|
||||
};
|
||||
use crate::prelude::*;
|
||||
|
||||
|
@ -25,7 +25,7 @@ impl FormatNodeRule<PatternMatchSequence> for FormatPatternMatchSequence {
|
|||
// If the sequence is empty, format the empty parentheses, along with any dangling
|
||||
// comments.
|
||||
([], SequenceType::Tuple | SequenceType::TupleNoParens) => {
|
||||
return empty_parenthesized("(", dangling, ")").fmt(f)
|
||||
return empty_parenthesized("(", dangling, ")").fmt(f);
|
||||
}
|
||||
([], SequenceType::List) => return empty_parenthesized("[", dangling, "]").fmt(f),
|
||||
|
||||
|
@ -34,7 +34,7 @@ impl FormatNodeRule<PatternMatchSequence> for FormatPatternMatchSequence {
|
|||
([elt], SequenceType::Tuple | SequenceType::TupleNoParens) => {
|
||||
return parenthesized("(", &format_args![elt.format(), token(",")], ")")
|
||||
.with_dangling_comments(dangling)
|
||||
.fmt(f)
|
||||
.fmt(f);
|
||||
}
|
||||
|
||||
_ => {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue