@@ -33,7 +33,9 @@ impl Linter for AnA {
33
33
34
34
let is_a_an = match chars_first {
35
35
[ 'a' ] => Some ( true ) ,
36
+ [ 'A' ] => Some ( true ) ,
36
37
[ 'a' , 'n' ] => Some ( false ) ,
38
+ [ 'A' , 'n' ] => Some ( false ) ,
37
39
_ => None ,
38
40
} ;
39
41
@@ -52,7 +54,10 @@ impl Linter for AnA {
52
54
lints. push ( Lint {
53
55
span : first. span ,
54
56
lint_kind : LintKind :: Miscellaneous ,
55
- suggestions : vec ! [ Suggestion :: ReplaceWith ( replacement) ] ,
57
+ suggestions : vec ! [ Suggestion :: replace_with_match_case(
58
+ replacement,
59
+ chars_first,
60
+ ) ] ,
56
61
message : "Incorrect indefinite article." . to_string ( ) ,
57
62
priority : 31 ,
58
63
} )
@@ -113,7 +118,8 @@ fn starts_with_vowel(word: &[char]) -> bool {
113
118
| [ 'u' , 'n' , 'i' , 'n' | 'm' , ..]
114
119
| [ 'u' , 'n' , 'a' | 'u' , ..]
115
120
| [ 'h' , 'e' , 'r' , 'b' , ..]
116
- | [ 'u' , 'r' , 'b' , ..] )
121
+ | [ 'u' , 'r' , 'b' , ..]
122
+ | [ 'i' , 'n' , 't' , ..] )
117
123
{
118
124
return true ;
119
125
}
@@ -250,4 +256,13 @@ mod tests {
250
256
fn disallows_uppercase_consonants ( ) {
251
257
assert_lint_count ( "not an Crash" , AnA , 1 ) ;
252
258
}
259
+
260
+ #[ test]
261
+ fn disallows_a_interface ( ) {
262
+ assert_lint_count (
263
+ "A interface for an object that can perform linting actions." ,
264
+ AnA ,
265
+ 1 ,
266
+ ) ;
267
+ }
253
268
}
0 commit comments