@@ -42,31 +42,21 @@ pub(crate) fn complete_known_attribute_input(
4242) -> Option < ( ) > {
4343 let attribute = fake_attribute_under_caret;
4444 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 ( ) ?;
4849
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 (
6353 acc,
6454 ctx,
6555 colon_prefix,
6656 & parse_tt_as_comma_sep_paths ( tt, ctx. edition ) ?,
6757 FEATURES ,
6858 ) ,
69- "allow" | "expect" | "deny" | "forbid" | "warn" => {
59+ [ "allow" ] | [ "expect" ] | [ "deny" ] | [ "forbid" ] | [ "warn" ] => {
7060 let existing_lints = parse_tt_as_comma_sep_paths ( tt, ctx. edition ) ?;
7161
7262 let lints: Vec < Lint > = CLIPPY_LINT_GROUPS
@@ -80,13 +70,14 @@ pub(crate) fn complete_known_attribute_input(
8070
8171 lint:: complete_lint ( acc, ctx, colon_prefix, & existing_lints, & lints) ;
8272 }
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 (
8575 acc,
8676 ctx,
8777 extern_crate,
8878 & parse_tt_as_comma_sep_paths ( tt, ctx. edition ) ?,
8979 ) ,
80+ [ "diagnostic" , "on_unimplemented" ] => diagnostic:: complete_on_unimplemented ( acc, ctx, tt) ,
9081 _ => ( ) ,
9182 }
9283 Some ( ( ) )
0 commit comments