diff options
author | Nick Fitzgerald <fitzgen@gmail.com> | 2017-07-27 14:15:16 -0700 |
---|---|---|
committer | Nick Fitzgerald <fitzgen@gmail.com> | 2017-07-27 14:15:16 -0700 |
commit | 66f600eed117b9f7f5197ce1e3429539aac24365 (patch) | |
tree | d879d4c8fe4f87d0f185927fcbf621ba6b322018 | |
parent | d10b68eb7cb1aac5cfe3208cf16cab2a282afb40 (diff) |
Remove the `CanDeriveDebug::Extra` associated type
Similar to `HasVtable::Extra`, it is no longer needed.
-rw-r--r-- | src/codegen/mod.rs | 2 | ||||
-rw-r--r-- | src/ir/context.rs | 6 | ||||
-rw-r--r-- | src/ir/derive.rs | 10 | ||||
-rw-r--r-- | src/ir/item.rs | 4 |
4 files changed, 5 insertions, 17 deletions
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs index 05e16a5b..4ae0bfeb 100644 --- a/src/codegen/mod.rs +++ b/src/codegen/mod.rs @@ -1414,7 +1414,7 @@ impl CodeGenerator for CompInfo { let is_union = self.kind() == CompKind::Union; let mut derives = vec![]; - if item.can_derive_debug(ctx, ()) { + if item.can_derive_debug(ctx) { derives.push("Debug"); } diff --git a/src/ir/context.rs b/src/ir/context.rs index 3232e8e6..6c38e8e7 100644 --- a/src/ir/context.rs +++ b/src/ir/context.rs @@ -40,10 +40,8 @@ impl ItemId { } impl CanDeriveDebug for ItemId { - type Extra = (); - - fn can_derive_debug(&self, ctx: &BindgenContext, _: ()) -> bool { - ctx.resolve_item(*self).can_derive_debug(ctx, ()) + fn can_derive_debug(&self, ctx: &BindgenContext) -> bool { + ctx.options().derive_debug && ctx.lookup_item_id_can_derive_debug(*self) } } diff --git a/src/ir/derive.rs b/src/ir/derive.rs index 446d2435..3334618c 100644 --- a/src/ir/derive.rs +++ b/src/ir/derive.rs @@ -10,17 +10,9 @@ use super::context::BindgenContext; /// derive debug or not, because of the limit rust has on 32 items as max in the /// array. pub trait CanDeriveDebug { - /// Implementations can define this type to get access to any extra - /// information required to determine whether they can derive `Debug`. If - /// extra information is unneeded, then this should simply be the unit type. - type Extra; - /// Return `true` if `Debug` can be derived for this thing, `false` /// otherwise. - fn can_derive_debug(&self, - ctx: &BindgenContext, - extra: Self::Extra) - -> bool; + fn can_derive_debug(&self, ctx: &BindgenContext) -> bool; } /// A trait that encapsulates the logic for whether or not we can derive `Debug`. diff --git a/src/ir/item.rs b/src/ir/item.rs index 96e7ae41..92954a8f 100644 --- a/src/ir/item.rs +++ b/src/ir/item.rs @@ -271,9 +271,7 @@ impl Trace for Item { } impl CanDeriveDebug for Item { - type Extra = (); - - fn can_derive_debug(&self, ctx: &BindgenContext, _: ()) -> bool { + fn can_derive_debug(&self, ctx: &BindgenContext) -> bool { ctx.options().derive_debug && ctx.lookup_item_id_can_derive_debug(self.id()) } } |