mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 02:39:12 +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
|
@ -5,13 +5,13 @@ use std::fs;
|
|||
use std::path::Path;
|
||||
|
||||
use ruff_annotate_snippets::{Level, Renderer, Snippet};
|
||||
use ruff_python_ast::visitor::source_order::{walk_module, SourceOrderVisitor, TraversalSignal};
|
||||
use ruff_python_ast::visitor::Visitor;
|
||||
use ruff_python_ast::visitor::source_order::{SourceOrderVisitor, TraversalSignal, walk_module};
|
||||
use ruff_python_ast::{self as ast, AnyNodeRef, Mod, PythonVersion};
|
||||
use ruff_python_parser::semantic_errors::{
|
||||
SemanticSyntaxChecker, SemanticSyntaxContext, SemanticSyntaxError,
|
||||
};
|
||||
use ruff_python_parser::{parse_unchecked, Mode, ParseErrorType, ParseOptions, Token};
|
||||
use ruff_python_parser::{Mode, ParseErrorType, ParseOptions, Token, parse_unchecked};
|
||||
use ruff_source_file::{LineIndex, OneIndexed, SourceCode};
|
||||
use ruff_text_size::{Ranged, TextLen, TextRange, TextSize};
|
||||
|
||||
|
@ -433,7 +433,9 @@ impl<'ast> SourceOrderVisitor<'ast> for ValidateAstVisitor<'ast> {
|
|||
);
|
||||
|
||||
if let Some(previous) = self.previous {
|
||||
assert_ne!(previous.range().ordering(node.range()), Ordering::Greater,
|
||||
assert_ne!(
|
||||
previous.range().ordering(node.range()),
|
||||
Ordering::Greater,
|
||||
"{path}: The ranges of the nodes are not strictly increasing when traversing the AST in pre-order.\nPrevious node: {previous:#?}\n\nCurrent node: {node:#?}\n\nRoot: {root:#?}",
|
||||
path = self.test_path.display(),
|
||||
root = self.parents.first()
|
||||
|
@ -441,7 +443,8 @@ impl<'ast> SourceOrderVisitor<'ast> for ValidateAstVisitor<'ast> {
|
|||
}
|
||||
|
||||
if let Some(parent) = self.parents.last() {
|
||||
assert!(parent.range().contains_range(node.range()),
|
||||
assert!(
|
||||
parent.range().contains_range(node.range()),
|
||||
"{path}: The range of the parent node does not fully enclose the range of the child node.\nParent node: {parent:#?}\n\nChild node: {node:#?}\n\nRoot: {root:#?}",
|
||||
path = self.test_path.display(),
|
||||
root = self.parents.first()
|
||||
|
@ -614,7 +617,7 @@ impl Visitor<'_> for SemanticSyntaxCheckerVisitor<'_> {
|
|||
self.visit_comprehension(comprehension);
|
||||
}
|
||||
self.scopes.push(Scope::Comprehension {
|
||||
is_async: generators.iter().any(|gen| gen.is_async),
|
||||
is_async: generators.iter().any(|generator| generator.is_async),
|
||||
});
|
||||
self.visit_expr(elt);
|
||||
self.scopes.pop().unwrap();
|
||||
|
@ -629,7 +632,7 @@ impl Visitor<'_> for SemanticSyntaxCheckerVisitor<'_> {
|
|||
self.visit_comprehension(comprehension);
|
||||
}
|
||||
self.scopes.push(Scope::Comprehension {
|
||||
is_async: generators.iter().any(|gen| gen.is_async),
|
||||
is_async: generators.iter().any(|generator| generator.is_async),
|
||||
});
|
||||
self.visit_expr(key);
|
||||
self.visit_expr(value);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue