@@ -3,7 +3,7 @@ use ruff_macros::{derive_message_formats, ViolationMetadata};
3
3
use ruff_python_ast:: helpers:: ReturnStatementVisitor ;
4
4
use ruff_python_ast:: identifier:: Identifier ;
5
5
use ruff_python_ast:: visitor:: Visitor ;
6
- use ruff_python_ast:: { self as ast, Expr , ParameterWithDefault , Stmt } ;
6
+ use ruff_python_ast:: { self as ast, Expr , Stmt } ;
7
7
use ruff_python_semantic:: analyze:: visibility;
8
8
use ruff_python_semantic:: Definition ;
9
9
use ruff_python_stdlib:: typing:: simple_magic_return_type;
@@ -613,21 +613,17 @@ pub(crate) fn definition(
613
613
let is_overridden = visibility:: is_override ( decorator_list, checker. semantic ( ) ) ;
614
614
615
615
// If this is a non-static method, skip `cls` or `self`.
616
- for ParameterWithDefault {
617
- parameter,
618
- default : _,
619
- range : _,
620
- } in parameters. iter_non_variadic_params ( ) . skip ( usize:: from (
616
+ for parameter in parameters. iter_non_variadic_params ( ) . skip ( usize:: from (
621
617
is_method && !visibility:: is_staticmethod ( decorator_list, checker. semantic ( ) ) ,
622
618
) ) {
623
619
// ANN401 for dynamically typed parameters
624
- if let Some ( annotation) = & parameter. annotation {
620
+ if let Some ( annotation) = parameter. annotation ( ) {
625
621
has_any_typed_arg = true ;
626
622
if checker. enabled ( Rule :: AnyType ) && !is_overridden {
627
623
check_dynamically_typed (
628
624
checker,
629
625
annotation,
630
- || parameter. name . to_string ( ) ,
626
+ || parameter. name ( ) . to_string ( ) ,
631
627
& mut diagnostics,
632
628
) ;
633
629
}
@@ -636,14 +632,14 @@ pub(crate) fn definition(
636
632
&& checker
637
633
. settings
638
634
. dummy_variable_rgx
639
- . is_match ( & parameter. name ) )
635
+ . is_match ( parameter. name ( ) ) )
640
636
{
641
637
if checker. enabled ( Rule :: MissingTypeFunctionArgument ) {
642
638
diagnostics. push ( Diagnostic :: new (
643
639
MissingTypeFunctionArgument {
644
- name : parameter. name . to_string ( ) ,
640
+ name : parameter. name ( ) . to_string ( ) ,
645
641
} ,
646
- parameter. range ( ) ,
642
+ parameter. parameter . range ( ) ,
647
643
) ) ;
648
644
}
649
645
}
@@ -915,7 +911,7 @@ pub(crate) fn definition(
915
911
. posonlyargs
916
912
. first ( )
917
913
. or_else ( || parameters. args . first ( ) )
918
- . is_some_and ( |first_param| first_param. parameter . annotation . is_some ( ) ) )
914
+ . is_some_and ( |first_param| first_param. annotation ( ) . is_some ( ) ) )
919
915
{
920
916
diagnostics
921
917
} else {
0 commit comments