summaryrefslogtreecommitdiff
path: root/bindgen/codegen/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'bindgen/codegen/mod.rs')
-rw-r--r--bindgen/codegen/mod.rs21
1 files changed, 9 insertions, 12 deletions
diff --git a/bindgen/codegen/mod.rs b/bindgen/codegen/mod.rs
index bf0b3356..a59265ab 100644
--- a/bindgen/codegen/mod.rs
+++ b/bindgen/codegen/mod.rs
@@ -2112,12 +2112,11 @@ impl CodeGenerator for CompInfo {
// The custom derives callback may return a list of derive attributes;
// add them to the end of the list.
- let custom_derives;
- if let Some(cb) = &ctx.options().parse_callbacks {
- custom_derives = cb.add_derives(&canonical_name);
- // In most cases this will be a no-op, since custom_derives will be empty.
- derives.extend(custom_derives.iter().map(|s| s.as_str()));
- };
+ let custom_derives = ctx
+ .options()
+ .all_callbacks(|cb| cb.add_derives(&canonical_name));
+ // In most cases this will be a no-op, since custom_derives will be empty.
+ derives.extend(custom_derives.iter().map(|s| s.as_str()));
if !derives.is_empty() {
attributes.push(attributes::derives(&derives))
@@ -3152,12 +3151,10 @@ impl CodeGenerator for Enum {
// The custom derives callback may return a list of derive attributes;
// add them to the end of the list.
- let custom_derives;
- if let Some(cb) = &ctx.options().parse_callbacks {
- custom_derives = cb.add_derives(&name);
- // In most cases this will be a no-op, since custom_derives will be empty.
- derives.extend(custom_derives.iter().map(|s| s.as_str()));
- };
+ let custom_derives =
+ ctx.options().all_callbacks(|cb| cb.add_derives(&name));
+ // In most cases this will be a no-op, since custom_derives will be empty.
+ derives.extend(custom_derives.iter().map(|s| s.as_str()));
attrs.push(attributes::derives(&derives));
}