@@ -23,12 +23,12 @@ pub struct DisallowedPath<const REPLACEMENT_ALLOWED: bool = true> {
23
23
path : String ,
24
24
reason : Option < String > ,
25
25
replacement : Option < String > ,
26
- /// Setting `may_not_refer_to_existing_definition ` to true suppresses a warning if `path` does
27
- /// not refer to an existing definition.
26
+ /// Setting `allow_invalid ` to true suppresses a warning if `path` does not refer to an existing
27
+ /// definition.
28
28
///
29
29
/// This could be useful when conditional compilation is used, or when a clippy.toml file is
30
30
/// shared among multiple projects.
31
- may_not_refer_to_existing_definition : bool ,
31
+ allow_invalid : bool ,
32
32
/// The span of the `DisallowedPath`.
33
33
///
34
34
/// Used for diagnostics.
@@ -49,7 +49,7 @@ impl<'de, const REPLACEMENT_ALLOWED: bool> Deserialize<'de> for DisallowedPath<R
49
49
path : enum_. path ( ) . to_owned ( ) ,
50
50
reason : enum_. reason ( ) . map ( ToOwned :: to_owned) ,
51
51
replacement : enum_. replacement ( ) . map ( ToOwned :: to_owned) ,
52
- may_not_refer_to_existing_definition : enum_. may_not_refer_to_existing_definition ( ) ,
52
+ allow_invalid : enum_. allow_invalid ( ) ,
53
53
span : Span :: default ( ) ,
54
54
} )
55
55
}
@@ -65,8 +65,8 @@ enum DisallowedPathEnum {
65
65
path : String ,
66
66
reason : Option < String > ,
67
67
replacement : Option < String > ,
68
- #[ serde( rename = "may-not-refer-to-existing-definition " ) ]
69
- may_not_refer_to_existing_definition : Option < bool > ,
68
+ #[ serde( rename = "allow-invalid " ) ]
69
+ allow_invalid : Option < bool > ,
70
70
} ,
71
71
}
72
72
@@ -120,12 +120,9 @@ impl DisallowedPathEnum {
120
120
}
121
121
}
122
122
123
- fn may_not_refer_to_existing_definition ( & self ) -> bool {
123
+ fn allow_invalid ( & self ) -> bool {
124
124
match & self {
125
- Self :: WithReason {
126
- may_not_refer_to_existing_definition,
127
- ..
128
- } => may_not_refer_to_existing_definition. unwrap_or_default ( ) ,
125
+ Self :: WithReason { allow_invalid, .. } => allow_invalid. unwrap_or_default ( ) ,
129
126
Self :: Simple ( _) => false ,
130
127
}
131
128
}
@@ -181,7 +178,7 @@ pub fn create_disallowed_map<const REPLACEMENT_ALLOWED: bool>(
181
178
span,
182
179
format ! ( "expected a {predicate_description}, found a primitive type" , ) ,
183
180
) ;
184
- } else if !disallowed_path. may_not_refer_to_existing_definition {
181
+ } else if !disallowed_path. allow_invalid {
185
182
tcx. sess . dcx ( ) . span_warn (
186
183
span,
187
184
format ! ( "`{path}` does not refer to an existing {predicate_description}" ) ,
0 commit comments