Skip to content

Commit 3afa60b

Browse files
committed
fix: store FunctionKind in Function variant instead of AttributeInfo
1 parent 8bf98e3 commit 3afa60b

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

bindgen/callbacks.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,6 @@ pub struct AttributeInfo<'a> {
241241
pub name: &'a str,
242242
/// The kind of the item.
243243
pub kind: AttributeItemKind,
244-
/// The kind of a method item.
245-
pub fn_kind: Option<FunctionKind>,
246244
}
247245

248246
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
@@ -255,7 +253,7 @@ pub enum AttributeItemKind {
255253
/// The item is a Rust `union`.
256254
Union,
257255
/// The item is a Rust `fn`.
258-
Function,
256+
Function(FunctionKind),
259257
}
260258

261259
#[derive(Debug, Clone, Copy, PartialEq, Eq)]

bindgen/codegen/mod.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,7 +1071,6 @@ impl CodeGenerator for Type {
10711071
cb.add_attributes(&AttributeInfo {
10721072
name: &name,
10731073
kind: AttributeItemKind::Struct,
1074-
fn_kind: None,
10751074
})
10761075
});
10771076
attributes.extend(
@@ -2538,7 +2537,6 @@ impl CodeGenerator for CompInfo {
25382537
} else {
25392538
AttributeItemKind::Struct
25402539
},
2541-
fn_kind: None,
25422540
})
25432541
});
25442542
attributes.extend(custom_attributes.iter().map(|s| s.parse().unwrap()));
@@ -3153,8 +3151,7 @@ impl Method {
31533151
let custom_attributes = ctx.options().all_callbacks(|cb| {
31543152
cb.add_attributes(&AttributeInfo {
31553153
name: &canonical_name,
3156-
kind: AttributeItemKind::Function,
3157-
fn_kind: Some(FunctionKind::Method(self.kind())),
3154+
kind: AttributeItemKind::Function(FunctionKind::Method(self.kind())),
31583155
})
31593156
});
31603157
attrs.extend(custom_attributes.iter().map(|s| s.parse().unwrap()));
@@ -3740,7 +3737,6 @@ impl CodeGenerator for Enum {
37403737
cb.add_attributes(&AttributeInfo {
37413738
name: &name,
37423739
kind: AttributeItemKind::Enum,
3743-
fn_kind: None,
37443740
})
37453741
});
37463742
attrs.extend(custom_attributes.iter().map(|s| s.parse().unwrap()));
@@ -4608,8 +4604,7 @@ impl CodeGenerator for Function {
46084604
let custom_attributes = ctx.options().all_callbacks(|cb| {
46094605
cb.add_attributes(&AttributeInfo {
46104606
name: &canonical_name,
4611-
kind: AttributeItemKind::Function,
4612-
fn_kind: Some(self.kind()),
4607+
kind: AttributeItemKind::Function(self.kind()),
46134608
})
46144609
});
46154610
attributes.extend(custom_attributes.iter().map(|s| s.parse().unwrap()));

0 commit comments

Comments
 (0)