Repository: astral-sh/ruff
File: crates/ruff_linter/src/checkers/ast/mod.rs (Rust)

Code before:
                        }
                    }
                    Some(typing::Callable::TypeVar) => {
                        let mut args = arguments.args.iter();
                        if let Some(arg) = args.next() {
                            self.visit_non_type_definition(arg);
                        }
                        for arg in args {
                            self.visit_type_definition(arg);
                        }
                        for keyword in &*arguments.keywords {
                            let Keyword {
                                arg,
                                value,
                                range: _,
                                node_index: _,
                            } = keyword;
                            if let Some(id) = arg {
                                if matches!(&**id, "bound" | "default") {
                                    self.visit_type_definition(value);
                                } else {
                                    self.visit_non_type_definition(value);
                                }
                            } else {
                                // The only case when a keyword argument is None is when using **kwargs, since there is no explicit 'arg' name for it.
                                // Ex: typing.TypeVar(*args, **kwargs)
                                self.visit_non_type_definition(value);
                            }
                        }
                    }
                    Some(typing::Callable::TypeAliasType) => {
                        // Ex) TypeAliasType("Json", "Union[dict[str, Json]]", type_params=())
                        for (i, arg) in arguments.arguments_source_order().enumerate() {
                            match (i, arg) {
                                (1, ArgOrKeyword::Arg(arg)) => self.visit_type_definition(arg),
                                (_, ArgOrKeyword::Arg(arg)) => self.visit_non_type_definition(arg),
                                (_, ArgOrKeyword::Keyword(Keyword { arg, value, .. })) => {
                                    if let Some(id) = arg {
                                        if matches!(&**id, "value" | "type_params") {
                                            self.visit_type_definition(value);
                                        } else {
                                            self.visit_non_type_definition(value);
                                        }
                                    }
                                }
                            }
                        }
                    }
                    Some(typing::Callable::NamedTuple) => {
                        // Ex) NamedTuple("a", [("a", int)])
                        let mut args = arguments.args.iter();

Review comment (suggestion):
I'm not sure we need the first part of this comment, but I like the example.


```suggestion
                                // Ex: typing.TypeVar(**kwargs)
```

I just removed the `*args` to make it even more clear which part is relevant.

Code after:
                        }
                    }
                    Some(typing::Callable::TypeVar) => {
                        let mut args = arguments.args.iter();
                        if let Some(arg) = args.next() {
                            self.visit_non_type_definition(arg);
                        }
                        for arg in args {
                            self.visit_type_definition(arg);
                        }
                        for keyword in &*arguments.keywords {
                            let Keyword {
                                arg,
                                value,
                                range: _,
                                node_index: _,
                            } = keyword;
                            if let Some(id) = arg {
                                if matches!(&**id, "bound" | "default") {
                                    self.visit_type_definition(value);
                                } else {
                                    self.visit_non_type_definition(value);
                                }
                            } else {
                                // Ex: typing.TypeVar(**kwargs)
                                self.visit_non_type_definition(value);
                            }
                        }
                    }
                    Some(typing::Callable::TypeAliasType) => {
                        // Ex) TypeAliasType("Json", "Union[dict[str, Json]]", type_params=())
                        for (i, arg) in arguments.arguments_source_order().enumerate() {
                            match (i, arg) {
                                (1, ArgOrKeyword::Arg(arg)) => self.visit_type_definition(arg),
                                (_, ArgOrKeyword::Arg(arg)) => self.visit_non_type_definition(arg),
                                (_, ArgOrKeyword::Keyword(Keyword { arg, value, .. })) => {
                                    if let Some(id) = arg {
                                        if matches!(&**id, "value" | "type_params") {
                                            self.visit_type_definition(value);
                                        } else {
                                            self.visit_non_type_definition(value);
                                        }
                                    }
                                }
                            }
                        }
                    }
                    Some(typing::Callable::NamedTuple) => {
                        // Ex) NamedTuple("a", [("a", int)])
                        let mut args = arguments.args.iter();
                        if let Some(arg) = args.next() {