Skip to content

Commit

Permalink
limit support to "cfg_attr" only
Browse files Browse the repository at this point in the history
  • Loading branch information
saks committed May 24, 2024
1 parent 83ff3c6 commit a5e536f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion uniffi_macros/src/export/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ impl ExportedImplFnAttributes {

if is_uniffi_path(path) {
this.process_path(path, attr, &attr.meta)?;
} else if matches!(attr.meta, Meta::List(_)) {
} else if is_cfg_attr(attr) {
if let Ok(nested) =
attr.parse_args_with(Punctuated::<Meta, Token![,]>::parse_terminated)
{
Expand Down Expand Up @@ -329,6 +329,13 @@ fn is_uniffi_path(path: &Path) -> bool {
.unwrap_or(false)
}

fn is_cfg_attr(attr: &Attribute) -> bool {
attr.meta
.path()
.get_ident()
.is_some_and(|ident| *ident == "cfg_attr")
}

fn ensure_no_path_args(seg: &PathSegment) -> syn::Result<()> {
if matches!(seg.arguments, PathArguments::None) {
Ok(())
Expand Down

0 comments on commit a5e536f

Please sign in to comment.