-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
When deriving ExtractAttributes on an attribute struct with no fields, such as in the following examples:
#[derive(ExtractAttributes)]
#[deluxe(attributes(my_attribute_1)]
struct MyStruct1;
#[derive(ExtractAttributes)]
#[deluxe(attributes(my_attribute_2)]
struct MyStruct2();
#[derive(ExtractAttributes)]
#[deluxe(attributes(my_attribute_3)]
struct MyStruct3 {}extract_attributes() does not work as it would be expected to. Instead of returning Err(_) it returns Ok(_) whether or not there is an attribute with the correct name on the type.
#[derive(MyTrait)]
#[my_attribute_1]
struct MyStructWithAttribute {
my_field: MyType,
}
#[derive(MyTrait)]
struct MyStructWithoutAttribute {
my_field: MyType,
}
// In the derive for `MyStructWithAttribute`:
let attribute: Option<MyAttribute> = extract_attributes(&mut ast); // Evaluates to Some(_)
// In the derive for `MyStructWithoutAttribute`:
let attribute: Option<MyAttribute> = extract_attributes(&mut ast); // Evaluates to Some(_)The expected behavior would be that MyStructWithoutAttribute's derive would return an error.
Metadata
Metadata
Assignees
Labels
No labels