diff --git a/crates/ruff/src/docstrings/sections.rs b/crates/ruff/src/docstrings/sections.rs index d61697a1c5..48f38e606d 100644 --- a/crates/ruff/src/docstrings/sections.rs +++ b/crates/ruff/src/docstrings/sections.rs @@ -205,8 +205,8 @@ impl<'a> SectionContexts<'a> { } impl<'a> IntoIterator for &'a SectionContexts<'a> { - type Item = SectionContext<'a>; type IntoIter = SectionContextsIter<'a>; + type Item = SectionContext<'a>; fn into_iter(self) -> Self::IntoIter { self.iter() diff --git a/crates/ruff/src/message/diff.rs b/crates/ruff/src/message/diff.rs index 8bda1c0534..c665578c2a 100644 --- a/crates/ruff/src/message/diff.rs +++ b/crates/ruff/src/message/diff.rs @@ -60,7 +60,7 @@ impl Display for Diff<'_> { Applicability::Automatic => "Fix", Applicability::Suggested => "Suggested fix", Applicability::Manual => "Possible fix", - Applicability::Unspecified => "Suggested fix", // For backwards compatibility, unspecified fixes are 'suggested' + Applicability::Unspecified => "Suggested fix", /* For backwards compatibility, unspecified fixes are 'suggested' */ }; writeln!(f, "ℹ {}", message.blue())?; diff --git a/crates/ruff/src/message/mod.rs b/crates/ruff/src/message/mod.rs index 821191bbad..f86e408ecd 100644 --- a/crates/ruff/src/message/mod.rs +++ b/crates/ruff/src/message/mod.rs @@ -94,6 +94,7 @@ struct MessageWithLocation<'a> { impl Deref for MessageWithLocation<'_> { type Target = Message; + fn deref(&self) -> &Self::Target { self.message } diff --git a/crates/ruff/src/registry/rule_set.rs b/crates/ruff/src/registry/rule_set.rs index 7fdbf8b19d..97e7ac7f3b 100644 --- a/crates/ruff/src/registry/rule_set.rs +++ b/crates/ruff/src/registry/rule_set.rs @@ -13,7 +13,6 @@ pub struct RuleSet([u64; RULESET_SIZE]); impl RuleSet { const EMPTY: [u64; RULESET_SIZE] = [0; RULESET_SIZE]; - // 64 fits into a u16 without truncation #[allow(clippy::cast_possible_truncation)] const SLICE_BITS: u16 = u64::BITS as u16; @@ -290,8 +289,8 @@ impl Extend for RuleSet { } impl IntoIterator for RuleSet { - type Item = Rule; type IntoIter = RuleSetIterator; + type Item = Rule; fn into_iter(self) -> Self::IntoIter { self.iter() @@ -299,8 +298,8 @@ impl IntoIterator for RuleSet { } impl IntoIterator for &RuleSet { - type Item = Rule; type IntoIter = RuleSetIterator; + type Item = Rule; fn into_iter(self) -> Self::IntoIter { self.iter() diff --git a/crates/ruff/src/rule_selector.rs b/crates/ruff/src/rule_selector.rs index 6985c1be3c..6247346a51 100644 --- a/crates/ruff/src/rule_selector.rs +++ b/crates/ruff/src/rule_selector.rs @@ -145,8 +145,8 @@ impl From for RuleSelector { } impl IntoIterator for &RuleSelector { - type Item = Rule; type IntoIter = RuleSelectorIter; + type Item = Rule; fn into_iter(self) -> Self::IntoIter { match self { diff --git a/crates/ruff/src/rules/pep8_naming/rules/mixed_case_variable_in_global_scope.rs b/crates/ruff/src/rules/pep8_naming/rules/mixed_case_variable_in_global_scope.rs index 158f03eaea..4024ba9998 100644 --- a/crates/ruff/src/rules/pep8_naming/rules/mixed_case_variable_in_global_scope.rs +++ b/crates/ruff/src/rules/pep8_naming/rules/mixed_case_variable_in_global_scope.rs @@ -20,7 +20,7 @@ use crate::rules::pep8_naming::helpers; /// > Modules that are designed for use via from M import * should use the /// __all__ mechanism to prevent exporting globals, or use the older /// convention of prefixing such globals with an underscore (which you might -///want to do to indicate these globals are “module non-public”). +/// want to do to indicate these globals are “module non-public”). /// > /// > ### Function and Variable Names /// > Function names should be lowercase, with words separated by underscores diff --git a/crates/ruff/src/rules/pycodestyle/rules/logical_lines/indentation.rs b/crates/ruff/src/rules/pycodestyle/rules/logical_lines/indentation.rs index a059ee9b6c..9f7f3b652b 100644 --- a/crates/ruff/src/rules/pycodestyle/rules/logical_lines/indentation.rs +++ b/crates/ruff/src/rules/pycodestyle/rules/logical_lines/indentation.rs @@ -82,7 +82,6 @@ impl Violation for IndentationWithInvalidMultipleComment { /// ```python /// for item in items: /// pass -/// /// ``` /// /// Use instead: diff --git a/crates/ruff/src/rules/pycodestyle/rules/logical_lines/mod.rs b/crates/ruff/src/rules/pycodestyle/rules/logical_lines/mod.rs index a00c71e750..9158cac000 100644 --- a/crates/ruff/src/rules/pycodestyle/rules/logical_lines/mod.rs +++ b/crates/ruff/src/rules/pycodestyle/rules/logical_lines/mod.rs @@ -95,8 +95,8 @@ impl Debug for LogicalLines<'_> { } impl<'a> IntoIterator for &'a LogicalLines<'a> { - type Item = LogicalLine<'a>; type IntoIter = LogicalLinesIter<'a>; + type Item = LogicalLine<'a>; fn into_iter(self) -> Self::IntoIter { LogicalLinesIter { diff --git a/crates/ruff/src/rules/pycodestyle/rules/logical_lines/whitespace_around_keywords.rs b/crates/ruff/src/rules/pycodestyle/rules/logical_lines/whitespace_around_keywords.rs index d65d1a1693..5c87d7df30 100644 --- a/crates/ruff/src/rules/pycodestyle/rules/logical_lines/whitespace_around_keywords.rs +++ b/crates/ruff/src/rules/pycodestyle/rules/logical_lines/whitespace_around_keywords.rs @@ -41,7 +41,6 @@ impl Violation for MultipleSpacesAfterKeyword { /// ## Example /// ```python /// True and False -/// /// ``` /// /// Use instead: @@ -67,7 +66,6 @@ impl Violation for MultipleSpacesBeforeKeyword { /// ## Example /// ```python /// True and\tFalse -/// /// ``` /// /// Use instead: @@ -93,7 +91,6 @@ impl Violation for TabAfterKeyword { /// ## Example /// ```python /// True\tand False -/// /// ``` /// /// Use instead: diff --git a/crates/ruff/src/rules/pycodestyle/rules/logical_lines/whitespace_before_comment.rs b/crates/ruff/src/rules/pycodestyle/rules/logical_lines/whitespace_before_comment.rs index e9ee52f52d..3a42136dcb 100644 --- a/crates/ruff/src/rules/pycodestyle/rules/logical_lines/whitespace_before_comment.rs +++ b/crates/ruff/src/rules/pycodestyle/rules/logical_lines/whitespace_before_comment.rs @@ -116,7 +116,6 @@ impl Violation for NoSpaceAfterBlockComment { /// ## Example /// ```python /// ### Block comment -/// /// ``` /// /// Use instead: diff --git a/crates/ruff/src/rules/pycodestyle/rules/trailing_whitespace.rs b/crates/ruff/src/rules/pycodestyle/rules/trailing_whitespace.rs index 836eafe9e9..f4841a385d 100644 --- a/crates/ruff/src/rules/pycodestyle/rules/trailing_whitespace.rs +++ b/crates/ruff/src/rules/pycodestyle/rules/trailing_whitespace.rs @@ -50,7 +50,6 @@ impl AlwaysAutofixableViolation for TrailingWhitespace { /// ## Example /// ```python /// class Foo(object):\n \n bang = 12 -/// /// ``` /// /// Use instead: diff --git a/crates/ruff/src/settings/options_base.rs b/crates/ruff/src/settings/options_base.rs index 2450f73bfb..ed325db917 100644 --- a/crates/ruff/src/settings/options_base.rs +++ b/crates/ruff/src/settings/options_base.rs @@ -70,7 +70,7 @@ impl OptionGroup { /// /// ### Find a nested options /// - ///```rust + /// ```rust /// # use ruff::settings::options_base::{OptionGroup, OptionEntry, OptionField}; /// /// const ignore_options: [(&'static str, OptionEntry); 2] = [ @@ -134,8 +134,8 @@ impl OptionGroup { } impl<'a> IntoIterator for &'a OptionGroup { - type Item = &'a (&'a str, OptionEntry); type IntoIter = std::slice::Iter<'a, (&'a str, OptionEntry)>; + type Item = &'a (&'a str, OptionEntry); fn into_iter(self) -> Self::IntoIter { self.0.iter() @@ -143,8 +143,8 @@ impl<'a> IntoIterator for &'a OptionGroup { } impl IntoIterator for OptionGroup { - type Item = &'static (&'static str, OptionEntry); type IntoIter = std::slice::Iter<'static, (&'static str, OptionEntry)>; + type Item = &'static (&'static str, OptionEntry); fn into_iter(self) -> Self::IntoIter { self.0.iter() diff --git a/crates/ruff_cache/src/cache_key.rs b/crates/ruff_cache/src/cache_key.rs index ee9669df09..e015112bda 100644 --- a/crates/ruff_cache/src/cache_key.rs +++ b/crates/ruff_cache/src/cache_key.rs @@ -24,6 +24,7 @@ impl CacheKeyHasher { impl Deref for CacheKeyHasher { type Target = DefaultHasher; + fn deref(&self) -> &Self::Target { &self.inner } diff --git a/crates/ruff_formatter/src/buffer.rs b/crates/ruff_formatter/src/buffer.rs index aa90a73a9a..13cb542085 100644 --- a/crates/ruff_formatter/src/buffer.rs +++ b/crates/ruff_formatter/src/buffer.rs @@ -29,7 +29,6 @@ pub trait Buffer { /// /// assert_eq!(buffer.into_vec(), vec![FormatElement::StaticText { text: "test" }]); /// ``` - /// fn write_element(&mut self, element: FormatElement) -> FormatResult<()>; /// Returns a slice containing all elements written into this buffer. diff --git a/crates/ruff_formatter/src/format_extensions.rs b/crates/ruff_formatter/src/format_extensions.rs index 82b99fda93..317d9c1337 100644 --- a/crates/ruff_formatter/src/format_extensions.rs +++ b/crates/ruff_formatter/src/format_extensions.rs @@ -57,7 +57,6 @@ pub trait MemoizeFormat { /// # Ok(()) /// # } /// ``` - /// fn memoized(self) -> Memoized where Self: Sized + Format, @@ -142,7 +141,6 @@ where /// assert_eq!("Counter:\n\tCount: 0\nCount: 0\n", formatted.print()?.as_code()); /// # Ok(()) /// # } - /// /// ``` pub fn inspect(&mut self, f: &mut Formatter) -> FormatResult<&[FormatElement]> { let result = self diff --git a/crates/ruff_formatter/src/lib.rs b/crates/ruff_formatter/src/lib.rs index e1f9e4f21e..d322b77a7a 100644 --- a/crates/ruff_formatter/src/lib.rs +++ b/crates/ruff_formatter/src/lib.rs @@ -721,7 +721,6 @@ where /// # Ok(()) /// # } /// ``` -/// #[inline(always)] pub fn write( output: &mut dyn Buffer, diff --git a/crates/ruff_index/src/slice.rs b/crates/ruff_index/src/slice.rs index ddb534ea82..77401e7133 100644 --- a/crates/ruff_index/src/slice.rs +++ b/crates/ruff_index/src/slice.rs @@ -127,8 +127,8 @@ impl IndexMut for IndexSlice { } impl<'a, I: Idx, T> IntoIterator for &'a IndexSlice { - type Item = &'a T; type IntoIter = std::slice::Iter<'a, T>; + type Item = &'a T; #[inline] fn into_iter(self) -> std::slice::Iter<'a, T> { @@ -137,8 +137,8 @@ impl<'a, I: Idx, T> IntoIterator for &'a IndexSlice { } impl<'a, I: Idx, T> IntoIterator for &'a mut IndexSlice { - type Item = &'a mut T; type IntoIter = std::slice::IterMut<'a, T>; + type Item = &'a mut T; #[inline] fn into_iter(self) -> std::slice::IterMut<'a, T> { diff --git a/crates/ruff_index/src/vec.rs b/crates/ruff_index/src/vec.rs index 36fa6388ac..516e53487f 100644 --- a/crates/ruff_index/src/vec.rs +++ b/crates/ruff_index/src/vec.rs @@ -121,8 +121,8 @@ impl FromIterator for IndexVec { } impl IntoIterator for IndexVec { - type Item = T; type IntoIter = std::vec::IntoIter; + type Item = T; #[inline] fn into_iter(self) -> std::vec::IntoIter { @@ -131,8 +131,8 @@ impl IntoIterator for IndexVec { } impl<'a, I: Idx, T> IntoIterator for &'a IndexVec { - type Item = &'a T; type IntoIter = std::slice::Iter<'a, T>; + type Item = &'a T; #[inline] fn into_iter(self) -> std::slice::Iter<'a, T> { @@ -141,8 +141,8 @@ impl<'a, I: Idx, T> IntoIterator for &'a IndexVec { } impl<'a, I: Idx, T> IntoIterator for &'a mut IndexVec { - type Item = &'a mut T; type IntoIter = std::slice::IterMut<'a, T>; + type Item = &'a mut T; #[inline] fn into_iter(self) -> std::slice::IterMut<'a, T> { diff --git a/crates/ruff_python_ast/src/imports.rs b/crates/ruff_python_ast/src/imports.rs index 098f75c0d6..6adfb9fce9 100644 --- a/crates/ruff_python_ast/src/imports.rs +++ b/crates/ruff_python_ast/src/imports.rs @@ -160,8 +160,8 @@ impl ImportMap { } impl<'a> IntoIterator for &'a ImportMap { - type Item = (&'a String, &'a Vec); type IntoIter = std::collections::hash_map::Iter<'a, String, Vec>; + type Item = (&'a String, &'a Vec); fn into_iter(self) -> Self::IntoIter { self.module_to_imports.iter() diff --git a/crates/ruff_python_ast/src/source_code/comment_ranges.rs b/crates/ruff_python_ast/src/source_code/comment_ranges.rs index cbbb414b54..189addc418 100644 --- a/crates/ruff_python_ast/src/source_code/comment_ranges.rs +++ b/crates/ruff_python_ast/src/source_code/comment_ranges.rs @@ -25,8 +25,8 @@ impl Debug for CommentRanges { } impl<'a> IntoIterator for &'a CommentRanges { - type Item = &'a TextRange; type IntoIter = std::slice::Iter<'a, TextRange>; + type Item = &'a TextRange; fn into_iter(self) -> Self::IntoIter { self.raw.iter() diff --git a/crates/ruff_python_ast/src/source_code/line_index.rs b/crates/ruff_python_ast/src/source_code/line_index.rs index 1096f1d1bf..157d75868e 100644 --- a/crates/ruff_python_ast/src/source_code/line_index.rs +++ b/crates/ruff_python_ast/src/source_code/line_index.rs @@ -245,12 +245,11 @@ impl IndexKind { pub struct OneIndexed(NonZeroUsize); impl OneIndexed { + /// The largest value that can be represented by this integer type + pub const MAX: Self = unwrap(Self::new(usize::MAX)); // SAFETY: These constants are being initialized with non-zero values /// The smallest value that can be represented by this integer type. pub const MIN: Self = unwrap(Self::new(1)); - /// The largest value that can be represented by this integer type - pub const MAX: Self = unwrap(Self::new(usize::MAX)); - pub const ONE: NonZeroUsize = unwrap(NonZeroUsize::new(1)); /// Creates a non-zero if the given value is not zero. diff --git a/crates/ruff_python_ast/src/visitor/preorder.rs b/crates/ruff_python_ast/src/visitor/preorder.rs index 974469ce0a..248070ec4d 100644 --- a/crates/ruff_python_ast/src/visitor/preorder.rs +++ b/crates/ruff_python_ast/src/visitor/preorder.rs @@ -1078,23 +1078,29 @@ class A: walk_expr(self, expr); self.exit_node(); } + fn visit_expr(&mut self, expr: &Expr) { self.enter_node(expr); walk_expr(self, expr); self.exit_node(); } + fn visit_constant(&mut self, constant: &Constant) { self.emit(&constant); } + fn visit_boolop(&mut self, boolop: &Boolop) { self.emit(&boolop); } + fn visit_operator(&mut self, operator: &Operator) { self.emit(&operator); } + fn visit_unaryop(&mut self, unaryop: &Unaryop) { self.emit(&unaryop); } + fn visit_cmpop(&mut self, cmpop: &Cmpop) { self.emit(&cmpop); } @@ -1104,51 +1110,61 @@ class A: walk_comprehension(self, comprehension); self.exit_node(); } + fn visit_excepthandler(&mut self, excepthandler: &Excepthandler) { self.enter_node(excepthandler); walk_excepthandler(self, excepthandler); self.exit_node(); } + fn visit_format_spec(&mut self, format_spec: &Expr) { self.enter_node(format_spec); walk_expr(self, format_spec); self.exit_node(); } + fn visit_arguments(&mut self, arguments: &Arguments) { self.enter_node(arguments); walk_arguments(self, arguments); self.exit_node(); } + fn visit_arg(&mut self, arg: &Arg) { self.enter_node(arg); walk_arg(self, arg); self.exit_node(); } + fn visit_keyword(&mut self, keyword: &Keyword) { self.enter_node(keyword); walk_keyword(self, keyword); self.exit_node(); } + fn visit_alias(&mut self, alias: &Alias) { self.enter_node(alias); walk_alias(self, alias); self.exit_node(); } + fn visit_withitem(&mut self, withitem: &Withitem) { self.enter_node(withitem); walk_withitem(self, withitem); self.exit_node(); } + fn visit_match_case(&mut self, match_case: &MatchCase) { self.enter_node(match_case); walk_match_case(self, match_case); self.exit_node(); } + fn visit_pattern(&mut self, pattern: &Pattern) { self.enter_node(pattern); walk_pattern(self, pattern); self.exit_node(); } + fn visit_type_ignore(&mut self, type_ignore: &TypeIgnore) { self.enter_node(type_ignore); walk_type_ignore(self, type_ignore); diff --git a/crates/ruff_python_formatter/src/comments/placement.rs b/crates/ruff_python_formatter/src/comments/placement.rs index c1c2b8df1f..2dabe23930 100644 --- a/crates/ruff_python_formatter/src/comments/placement.rs +++ b/crates/ruff_python_formatter/src/comments/placement.rs @@ -656,7 +656,7 @@ fn handle_positional_only_arguments_separator_comment<'a>( /// Handles comments between the left side and the operator of a binary expression (trailing comments of the left), /// and trailing end-of-line comments that are on the same line as the operator. /// -///```python +/// ```python /// a = ( /// 5 # trailing left comment /// + # trailing operator comment diff --git a/crates/ruff_python_formatter/src/comments/visitor.rs b/crates/ruff_python_formatter/src/comments/visitor.rs index a6cb1e40cc..4035cd05fe 100644 --- a/crates/ruff_python_formatter/src/comments/visitor.rs +++ b/crates/ruff_python_formatter/src/comments/visitor.rs @@ -257,6 +257,7 @@ impl<'ast> PreorderVisitor<'ast> for CommentsVisitor<'ast> { self.finish_node(withitem); } + fn visit_match_case(&mut self, match_case: &'ast MatchCase) { if self.start_node(match_case).is_traverse() { walk_match_case(self, match_case); diff --git a/crates/ruff_python_formatter/src/expression/expr_bin_op.rs b/crates/ruff_python_formatter/src/expression/expr_bin_op.rs index 0700bc888d..cd9618b28c 100644 --- a/crates/ruff_python_formatter/src/expression/expr_bin_op.rs +++ b/crates/ruff_python_formatter/src/expression/expr_bin_op.rs @@ -142,6 +142,7 @@ impl<'ast> AsFormat> for Operator { impl<'ast> IntoFormat> for Operator { type Format = FormatOwnedWithRule>; + fn into_format(self) -> Self::Format { FormatOwnedWithRule::new(self, FormatOperator) } diff --git a/crates/ruff_python_formatter/src/expression/mod.rs b/crates/ruff_python_formatter/src/expression/mod.rs index 706c59f29f..b6ca41efbd 100644 --- a/crates/ruff_python_formatter/src/expression/mod.rs +++ b/crates/ruff_python_formatter/src/expression/mod.rs @@ -163,6 +163,7 @@ impl NeedsParentheses for Expr { impl<'ast> AsFormat> for Expr { type Format<'a> = FormatRefWithRule<'a, Expr, FormatExpr, PyFormatContext<'ast>>; + fn format(&self) -> Self::Format<'_> { FormatRefWithRule::new(self, FormatExpr::default()) } @@ -170,6 +171,7 @@ impl<'ast> AsFormat> for Expr { impl<'ast> IntoFormat> for Expr { type Format = FormatOwnedWithRule>; + fn into_format(self) -> Self::Format { FormatOwnedWithRule::new(self, FormatExpr::default()) } diff --git a/crates/ruff_python_formatter/src/module/mod.rs b/crates/ruff_python_formatter/src/module/mod.rs index 6036af3942..34295fab4f 100644 --- a/crates/ruff_python_formatter/src/module/mod.rs +++ b/crates/ruff_python_formatter/src/module/mod.rs @@ -24,6 +24,7 @@ impl FormatRule> for FormatMod { impl<'ast> AsFormat> for Mod { type Format<'a> = FormatRefWithRule<'a, Mod, FormatMod, PyFormatContext<'ast>>; + fn format(&self) -> Self::Format<'_> { FormatRefWithRule::new(self, FormatMod::default()) } @@ -31,6 +32,7 @@ impl<'ast> AsFormat> for Mod { impl<'ast> IntoFormat> for Mod { type Format = FormatOwnedWithRule>; + fn into_format(self) -> Self::Format { FormatOwnedWithRule::new(self, FormatMod::default()) } diff --git a/crates/ruff_python_formatter/src/statement/mod.rs b/crates/ruff_python_formatter/src/statement/mod.rs index 42a18d1d3e..3abc1e6f93 100644 --- a/crates/ruff_python_formatter/src/statement/mod.rs +++ b/crates/ruff_python_formatter/src/statement/mod.rs @@ -70,6 +70,7 @@ impl FormatRule> for FormatStmt { impl<'ast> AsFormat> for Stmt { type Format<'a> = FormatRefWithRule<'a, Stmt, FormatStmt, PyFormatContext<'ast>>; + fn format(&self) -> Self::Format<'_> { FormatRefWithRule::new(self, FormatStmt::default()) } @@ -77,6 +78,7 @@ impl<'ast> AsFormat> for Stmt { impl<'ast> IntoFormat> for Stmt { type Format = FormatOwnedWithRule>; + fn into_format(self) -> Self::Format { FormatOwnedWithRule::new(self, FormatStmt::default()) } diff --git a/crates/ruff_python_formatter/src/statement/stmt_assign.rs b/crates/ruff_python_formatter/src/statement/stmt_assign.rs index 79182dafd9..cbc25342a9 100644 --- a/crates/ruff_python_formatter/src/statement/stmt_assign.rs +++ b/crates/ruff_python_formatter/src/statement/stmt_assign.rs @@ -7,7 +7,6 @@ use ruff_formatter::{write, Buffer, Format, FormatResult}; use ruff_python_ast::prelude::Expr; use rustpython_parser::ast::StmtAssign; -// // Note: This currently does wrap but not the black way so the types below likely need to be // replaced entirely // diff --git a/crates/ruff_python_formatter/src/statement/suite.rs b/crates/ruff_python_formatter/src/statement/suite.rs index 23b98f1798..3c075cf862 100644 --- a/crates/ruff_python_formatter/src/statement/suite.rs +++ b/crates/ruff_python_formatter/src/statement/suite.rs @@ -178,6 +178,7 @@ impl<'ast> AsFormat> for Suite { impl<'ast> IntoFormat> for Suite { type Format = FormatOwnedWithRule>; + fn into_format(self) -> Self::Format { FormatOwnedWithRule::new(self, FormatSuite::default()) } diff --git a/crates/ruff_python_semantic/src/definition.rs b/crates/ruff_python_semantic/src/definition.rs index 6d73624a66..c5cbbefa90 100644 --- a/crates/ruff_python_semantic/src/definition.rs +++ b/crates/ruff_python_semantic/src/definition.rs @@ -202,8 +202,8 @@ impl<'a> Deref for Definitions<'a> { } impl<'a> IntoIterator for Definitions<'a> { - type Item = Definition<'a>; type IntoIter = std::vec::IntoIter; + type Item = Definition<'a>; fn into_iter(self) -> Self::IntoIter { self.0.into_iter() diff --git a/crates/ruff_python_semantic/src/scope.rs b/crates/ruff_python_semantic/src/scope.rs index 69f9cca6d8..885452e7f5 100644 --- a/crates/ruff_python_semantic/src/scope.rs +++ b/crates/ruff_python_semantic/src/scope.rs @@ -250,6 +250,7 @@ impl Default for Scopes<'_> { impl<'a> Deref for Scopes<'a> { type Target = IndexSlice>; + fn deref(&self) -> &Self::Target { &self.0 }