diff --git a/crates/ruff_linter/src/upstream_categories.rs b/crates/ruff_linter/src/upstream_categories.rs index a00bfff3f0..c27c79e2f5 100644 --- a/crates/ruff_linter/src/upstream_categories.rs +++ b/crates/ruff_linter/src/upstream_categories.rs @@ -68,6 +68,7 @@ impl Rule { } } } + impl Linter { pub const fn upstream_categories(&self) -> Option<&'static [UpstreamCategoryAndPrefix]> { match self { diff --git a/crates/ruff_python_ast/src/all.rs b/crates/ruff_python_ast/src/all.rs index b55858d66f..3750680519 100644 --- a/crates/ruff_python_ast/src/all.rs +++ b/crates/ruff_python_ast/src/all.rs @@ -1,6 +1,7 @@ +use bitflags::bitflags; + use crate::helpers::map_subscript; use crate::{self as ast, Expr, Stmt}; -use bitflags::bitflags; bitflags! { #[derive(Default, Debug, Copy, Clone, PartialEq, Eq)] diff --git a/crates/ruff_python_ast/src/stmt_if.rs b/crates/ruff_python_ast/src/stmt_if.rs index e0d11978d6..08a69fd458 100644 --- a/crates/ruff_python_ast/src/stmt_if.rs +++ b/crates/ruff_python_ast/src/stmt_if.rs @@ -1,7 +1,9 @@ -use crate::{ElifElseClause, Expr, Stmt, StmtIf}; +use std::iter; + use ruff_python_trivia::{SimpleTokenKind, SimpleTokenizer}; use ruff_text_size::{Ranged, TextRange}; -use std::iter; + +use crate::{ElifElseClause, Expr, Stmt, StmtIf}; /// Return the `Range` of the first `Elif` or `Else` token in an `If` statement. pub fn elif_else_range(clause: &ElifElseClause, contents: &str) -> Option { @@ -17,11 +19,12 @@ pub enum BranchKind { Elif, } +#[derive(Debug)] pub struct IfElifBranch<'a> { pub kind: BranchKind, pub test: &'a Expr, pub body: &'a [Stmt], - pub range: TextRange, + range: TextRange, } impl Ranged for IfElifBranch<'_> { diff --git a/crates/ruff_python_semantic/src/definition.rs b/crates/ruff_python_semantic/src/definition.rs index 13108bcf16..6c58d5787b 100644 --- a/crates/ruff_python_semantic/src/definition.rs +++ b/crates/ruff_python_semantic/src/definition.rs @@ -265,8 +265,8 @@ impl<'a> Deref for Definitions<'a> { } impl<'a> IntoIterator for Definitions<'a> { - type IntoIter = std::vec::IntoIter; type Item = Definition<'a>; + type IntoIter = std::vec::IntoIter; fn into_iter(self) -> Self::IntoIter { self.0.into_iter()