@@ -42,31 +42,21 @@ pub(crate) fn complete_known_attribute_input(
42
42
) -> Option < ( ) > {
43
43
let attribute = fake_attribute_under_caret;
44
44
let path = attribute. path ( ) ?;
45
- let name_ref = path. segment ( ) ?. name_ref ( ) ;
46
- let ( name_ref, tt) = name_ref. zip ( attribute. token_tree ( ) ) ?;
47
- tt. l_paren_token ( ) ?;
45
+ let segments = path. segments ( ) . map ( |s| s. name_ref ( ) ) . collect :: < Option < Vec < _ > > > ( ) ?;
46
+ let segments = segments. iter ( ) . map ( |n| n. text ( ) ) . collect :: < Vec < _ > > ( ) ;
47
+ let segments = segments. iter ( ) . map ( |t| t. as_str ( ) ) . collect :: < Vec < _ > > ( ) ;
48
+ let tt = attribute. token_tree ( ) ?;
48
49
49
- if let Some ( qualifier) = path. qualifier ( ) {
50
- let qualifier_name_ref = qualifier. as_single_name_ref ( ) ?;
51
- match ( qualifier_name_ref. text ( ) . as_str ( ) , name_ref. text ( ) . as_str ( ) ) {
52
- ( "diagnostic" , "on_unimplemented" ) => {
53
- diagnostic:: complete_on_unimplemented ( acc, ctx, tt)
54
- }
55
- _ => ( ) ,
56
- }
57
- return Some ( ( ) ) ;
58
- }
59
-
60
- match name_ref. text ( ) . as_str ( ) {
61
- "repr" => repr:: complete_repr ( acc, ctx, tt) ,
62
- "feature" => lint:: complete_lint (
50
+ match segments. as_slice ( ) {
51
+ [ "repr" ] => repr:: complete_repr ( acc, ctx, tt) ,
52
+ [ "feature" ] => lint:: complete_lint (
63
53
acc,
64
54
ctx,
65
55
colon_prefix,
66
56
& parse_tt_as_comma_sep_paths ( tt, ctx. edition ) ?,
67
57
FEATURES ,
68
58
) ,
69
- "allow" | "expect" | "deny" | "forbid" | "warn" => {
59
+ [ "allow" ] | [ "expect" ] | [ "deny" ] | [ "forbid" ] | [ "warn" ] => {
70
60
let existing_lints = parse_tt_as_comma_sep_paths ( tt, ctx. edition ) ?;
71
61
72
62
let lints: Vec < Lint > = CLIPPY_LINT_GROUPS
@@ -80,13 +70,14 @@ pub(crate) fn complete_known_attribute_input(
80
70
81
71
lint:: complete_lint ( acc, ctx, colon_prefix, & existing_lints, & lints) ;
82
72
}
83
- "cfg" => cfg:: complete_cfg ( acc, ctx) ,
84
- "macro_use" => macro_use:: complete_macro_use (
73
+ [ "cfg" ] => cfg:: complete_cfg ( acc, ctx) ,
74
+ [ "macro_use" ] => macro_use:: complete_macro_use (
85
75
acc,
86
76
ctx,
87
77
extern_crate,
88
78
& parse_tt_as_comma_sep_paths ( tt, ctx. edition ) ?,
89
79
) ,
80
+ [ "diagnostic" , "on_unimplemented" ] => diagnostic:: complete_on_unimplemented ( acc, ctx, tt) ,
90
81
_ => ( ) ,
91
82
}
92
83
Some ( ( ) )
0 commit comments