Remove erroneous method calls in flake8-unused-arguments docs (#4771)

This commit is contained in:
Charlie Marsh 2023-05-31 22:23:59 -04:00 committed by GitHub
parent 1156c65be1
commit 3d34d9298d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 {