Update docs for `ANN401` (#6009)

Part of #5803
This commit is contained in:
Dhruv Manilawala 2023-07-23 21:45:04 +05:30 committed by GitHub
parent 46f8961292
commit 5dbb4dd823
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 3 deletions

View File

@ -30,7 +30,7 @@ pub(super) fn match_function_def(
body,
decorator_list,
),
_ => panic!("Found non-FunctionDef in match_name"),
_ => panic!("Found non-FunctionDef in match_function_def"),
}
}

View File

@ -376,7 +376,7 @@ impl Violation for MissingReturnTypeClassMethod {
}
/// ## What it does
/// Checks that an expression is annotated with a more specific type than
/// Checks that function arguments are annotated with a more specific type than
/// `Any`.
///
/// ## Why is this bad?
@ -399,9 +399,23 @@ impl Violation for MissingReturnTypeClassMethod {
/// ...
/// ```
///
/// ## Known problems
///
/// Type aliases are unsupported and can lead to false positives.
/// For example, the following will trigger this rule inadvertently:
/// ```python
/// from typing import Any
///
/// MyAny = Any
///
///
/// def foo(x: MyAny):
/// ...
/// ```
///
/// ## References
/// - [PEP 484](https://www.python.org/dev/peps/pep-0484/#the-any-type)
/// - [`typing.Any`](https://docs.python.org/3/library/typing.html#typing.Any)
/// - [Python documentation: `typing.Any`](https://docs.python.org/3/library/typing.html#typing.Any)
/// - [Mypy: The Any type](https://mypy.readthedocs.io/en/stable/kinds_of_types.html#the-any-type)
#[violation]
pub struct AnyType {