summaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 1170f9b0..9e54ddc9 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -247,7 +247,7 @@ impl Builder {
output_vector.push("--no-derive-debug".into());
}
- if !self.options.impl_debug {
+ if self.options.impl_debug {
output_vector.push("--impl-debug".into());
}
@@ -857,8 +857,9 @@ impl Builder {
}
/// Set whether `PartialEq` should be derived by default.
- /// If we don't compute partialeq, we also cannot compute
- /// eq. Set the derive_eq to `false` when doit is `false`.
+ ///
+ /// If we don't derive `PartialEq`, we also cannot derive `Eq`, so deriving
+ /// `Eq` is also disabled when `doit` is `false`.
pub fn derive_partialeq(mut self, doit: bool) -> Self {
self.options.derive_partialeq = doit;
if !doit {
@@ -868,16 +869,19 @@ impl Builder {
}
/// Set whether `Eq` should be derived by default.
- /// We can't compute Eq without computing PartialEq, so
- /// we set the same option to derive_partialeq.
+ ///
+ /// We can't derive `Eq` without also deriving `PartialEq`, so we also
+ /// enable deriving `PartialEq` when `doit` is `true`.
pub fn derive_eq(mut self, doit: bool) -> Self {
self.options.derive_eq = doit;
- self.options.derive_partialeq = doit;
+ if doit {
+ self.options.derive_partialeq = doit;
+ }
self
}
- /// Set whether or not to time bindgen phases, and print
- /// information to stderr.
+ /// Set whether or not to time bindgen phases, and print information to
+ /// stderr.
pub fn time_phases(mut self, doit: bool) -> Self {
self.options.time_phases = doit;
self
@@ -1686,7 +1690,7 @@ fn parse(context: &mut BindgenContext) -> Result<(), ()> {
for d in context.translation_unit().diags().iter() {
let msg = d.format();
let is_err = d.severity() >= CXDiagnostic_Error;
- println!("{}, err: {}", msg, is_err);
+ eprintln!("{}, err: {}", msg, is_err);
any_error |= is_err;
}