Completions,
};
+mod cfg;
mod derive;
mod lint;
+mod repr;
pub(crate) fn complete_attribute(acc: &mut Completions, ctx: &CompletionContext) -> Option<()> {
let attribute = ctx.attribute_under_caret.as_ref()?;
match (attribute.path().and_then(|p| p.as_single_name_ref()), attribute.token_tree()) {
(Some(path), Some(token_tree)) => match path.text().as_str() {
"derive" => derive::complete_derive(acc, ctx, token_tree),
+ "repr" => repr::complete_repr(acc, ctx, token_tree),
"feature" => lint::complete_lint(acc, ctx, token_tree, FEATURES),
"allow" | "warn" | "deny" | "forbid" => {
lint::complete_lint(acc, ctx, token_tree.clone(), DEFAULT_LINTS);
lint::complete_lint(acc, ctx, token_tree, CLIPPY_LINTS);
}
+ "cfg" => {
+ cfg::complete_cfg(acc, ctx);
+ }
_ => (),
},
(None, Some(_)) => (),
"#]],
);
}
+
+ #[test]
+ fn test_cfg() {
+ check(
+ r#"#[cfg(target_endian = $0"#,
+ expect![[r#"
+ at little
+ at big
+"#]],
+ );
+ }
}