diff --git a/crates/ruff_linter/resources/test/fixtures/flake8_unused_arguments/ARG.py b/crates/ruff_linter/resources/test/fixtures/flake8_unused_arguments/ARG.py index 311409e6ffb73b..e1725a43511fda 100644 --- a/crates/ruff_linter/resources/test/fixtures/flake8_unused_arguments/ARG.py +++ b/crates/ruff_linter/resources/test/fixtures/flake8_unused_arguments/ARG.py @@ -1,5 +1,5 @@ from abc import abstractmethod -from typing import overload, cast +from typing import overload, cast, TypeVar from typing_extensions import override @@ -256,3 +256,15 @@ def f(self, x, y): """Docstring.""" msg = t"{x}..." raise NotImplementedError(msg) + + +### +# Unused arguments with `**kwargs`. +### + +def f( + default: object = None, # noqa: ARG001 + **kwargs: object, +) -> None: + TypeVar(**kwargs) + diff --git a/crates/ruff_linter/src/checkers/ast/mod.rs b/crates/ruff_linter/src/checkers/ast/mod.rs index 37422cbf186d76..dd755e236bb430 100644 --- a/crates/ruff_linter/src/checkers/ast/mod.rs +++ b/crates/ruff_linter/src/checkers/ast/mod.rs @@ -1873,6 +1873,9 @@ impl<'a> Visitor<'a> for Checker<'a> { } else { self.visit_non_type_definition(value); } + } else { + // Ex: typing.TypeVar(**kwargs) + self.visit_non_type_definition(value); } } }