diff --git a/crates/ruff/src/rules/flake8_unused_arguments/rules/unused_arguments.rs b/crates/ruff/src/rules/flake8_unused_arguments/rules/unused_arguments.rs index 9313614c0e..f410b822cc 100644 --- a/crates/ruff/src/rules/flake8_unused_arguments/rules/unused_arguments.rs +++ b/crates/ruff/src/rules/flake8_unused_arguments/rules/unused_arguments.rs @@ -13,13 +13,13 @@ use ruff_python_semantic::analyze::visibility; use ruff_python_semantic::binding::Bindings; use ruff_python_semantic::scope::{Scope, ScopeKind}; -use super::super::helpers; - use crate::checkers::ast::Checker; use crate::registry::Rule; +use super::super::helpers; + /// An AST node that can contain arguments. -#[derive(Copy, Clone)] +#[derive(Debug, Copy, Clone)] enum Argumentable { Function, Method, @@ -29,7 +29,7 @@ enum Argumentable { } impl Argumentable { - pub(crate) fn check_for(self, name: String) -> DiagnosticKind { + fn check_for(self, name: String) -> DiagnosticKind { match self { Self::Function => UnusedFunctionArgument { name }.into(), Self::Method => UnusedMethodArgument { name }.into(), @@ -39,7 +39,7 @@ impl Argumentable { } } - pub(crate) const fn rule_code(self) -> Rule { + const fn rule_code(self) -> Rule { match self { Self::Function => Rule::UnusedFunctionArgument, Self::Method => Rule::UnusedMethodArgument, @@ -90,15 +90,15 @@ impl Violation for UnusedFunctionArgument { /// /// ## Example /// ```python -/// class MyClass: -/// def my_method(self, arg1, arg2): +/// class Class: +/// def foo(self, arg1, arg2): /// print(arg1) /// ``` /// /// Use instead: /// ```python -/// class MyClass: -/// def my_method(self, arg1): +/// class Class: +/// def foo(self, arg1): /// print(arg1) /// ``` #[violation] @@ -123,24 +123,18 @@ impl Violation for UnusedMethodArgument { /// /// ## Example /// ```python -/// class MyClass: +/// class Class: /// @classmethod -/// def my_method(self, arg1, arg2): +/// def foo(cls, arg1, arg2): /// print(arg1) -/// -/// def other_method(self): -/// self.my_method("foo", "bar") /// ``` /// /// Use instead: /// ```python -/// class MyClass: +/// class Class: /// @classmethod -/// def my_method(self, arg1): +/// def foo(cls, arg1): /// print(arg1) -/// -/// def other_method(self): -/// self.my_method("foo", "bar") /// ``` #[violation] pub struct UnusedClassMethodArgument { @@ -164,24 +158,18 @@ impl Violation for UnusedClassMethodArgument { /// /// ## Example /// ```python -/// class MyClass: +/// class Class: /// @staticmethod -/// def my_static_method(self, arg1, arg2): +/// def foo(arg1, arg2): /// print(arg1) -/// -/// def other_method(self): -/// self.my_static_method("foo", "bar") /// ``` /// /// Use instead: /// ```python -/// class MyClass: +/// class Class: /// @static -/// def my_static_method(self, arg1): +/// def foo(arg1): /// print(arg1) -/// -/// def other_method(self): -/// self.my_static_method("foo", "bar") /// ``` #[violation] pub struct UnusedStaticMethodArgument {