summaryrefslogtreecommitdiff
path: root/libbindgen/src
diff options
context:
space:
mode:
Diffstat (limited to 'libbindgen/src')
-rw-r--r--libbindgen/src/clang.rs4
-rw-r--r--libbindgen/src/codegen/mod.rs5
-rw-r--r--libbindgen/src/ir/comp.rs23
-rw-r--r--libbindgen/src/ir/item.rs16
-rw-r--r--libbindgen/src/ir/ty.rs11
-rw-r--r--libbindgen/src/lib.rs12
6 files changed, 35 insertions, 36 deletions
diff --git a/libbindgen/src/clang.rs b/libbindgen/src/clang.rs
index de0ebf15..fc5575b3 100644
--- a/libbindgen/src/clang.rs
+++ b/libbindgen/src/clang.rs
@@ -832,8 +832,8 @@ impl SourceLocation {
&mut col,
&mut off);
(File {
- x: file,
- },
+ x: file,
+ },
line as usize,
col as usize,
off as usize)
diff --git a/libbindgen/src/codegen/mod.rs b/libbindgen/src/codegen/mod.rs
index 12aa7223..5515527e 100644
--- a/libbindgen/src/codegen/mod.rs
+++ b/libbindgen/src/codegen/mod.rs
@@ -770,7 +770,8 @@ impl CodeGenerator for CompInfo {
derives.push("Debug");
}
- if item.can_derive_copy(ctx, ()) && !item.annotations().disallow_copy() {
+ if item.can_derive_copy(ctx, ()) &&
+ !item.annotations().disallow_copy() {
derives.push("Copy");
if !applicable_template_args.is_empty() {
// FIXME: This requires extra logic if you have a big array in a
@@ -895,7 +896,7 @@ impl CodeGenerator for CompInfo {
// Try to catch a bitfield contination early.
if let (Some(ref mut bitfield_width), Some(width)) =
- (current_bitfield_width, field.bitfield()) {
+ (current_bitfield_width, field.bitfield()) {
let layout = current_bitfield_layout.unwrap();
debug!("Testing bitfield continuation {} {} {:?}",
*bitfield_width, width, layout);
diff --git a/libbindgen/src/ir/comp.rs b/libbindgen/src/ir/comp.rs
index 5d09ddbc..3a0f5872 100644
--- a/libbindgen/src/ir/comp.rs
+++ b/libbindgen/src/ir/comp.rs
@@ -586,17 +586,18 @@ impl CompInfo {
return CXChildVisit_Continue;
}
- let param = Item::named_type(cur.spelling(),
- potential_id,
- ctx);
+ let param =
+ Item::named_type(cur.spelling(), potential_id, ctx);
ci.template_args.push(param);
}
CXCursor_CXXBaseSpecifier => {
if !ci.has_vtable {
ci.has_vtable = cur.is_virtual_base();
}
- let type_id =
- Item::from_ty_or_ref(cur.cur_type(), Some(cur), None, ctx);
+ let type_id = Item::from_ty_or_ref(cur.cur_type(),
+ Some(cur),
+ None,
+ ctx);
ci.base_members.push(type_id);
}
CXCursor_Constructor |
@@ -690,7 +691,9 @@ impl CompInfo {
return CXChildVisit_Continue;
}
- if let Ok(item) = Item::parse(cur, Some(potential_id), ctx) {
+ if let Ok(item) = Item::parse(cur,
+ Some(potential_id),
+ ctx) {
ci.inner_vars.push(item);
}
}
@@ -840,9 +843,7 @@ impl CanDeriveDebug for CompInfo {
self.fields
.iter()
.all(|f| f.can_derive_debug(ctx, ())) &&
- self.ref_template.map_or(true, |id| {
- id.can_derive_debug(ctx, ())
- })
+ self.ref_template.map_or(true, |id| id.can_derive_debug(ctx, ()))
};
self.detect_derive_debug_cycle.set(false);
@@ -889,9 +890,7 @@ impl<'a> CanDeriveCopy<'a> for CompInfo {
self.base_members
.iter()
.all(|t| t.can_derive_copy(ctx, ())) &&
- self.fields.iter().all(|field| {
- field.can_derive_copy(ctx, ())
- })
+ self.fields.iter().all(|field| field.can_derive_copy(ctx, ()))
}
fn can_derive_copy_in_array(&self,
diff --git a/libbindgen/src/ir/item.rs b/libbindgen/src/ir/item.rs
index 913fb2f2..f4598654 100644
--- a/libbindgen/src/ir/item.rs
+++ b/libbindgen/src/ir/item.rs
@@ -216,7 +216,7 @@ impl CanDeriveDebug for Item {
} else {
ty.can_derive_debug(ctx, ())
}
- },
+ }
_ => false,
}
}
@@ -550,8 +550,9 @@ impl Item {
parent_template_args.iter().any(|parent_item| {
let parent_ty = ctx.resolve_type(*parent_item);
match (parent_ty.kind(), item_ty.kind()) {
- (&TypeKind::Named(ref n),
- &TypeKind::Named(ref i)) => n == i,
+ (&TypeKind::Named(ref n), &TypeKind::Named(ref i)) => {
+ n == i
+ }
_ => false,
}
})
@@ -1115,7 +1116,7 @@ impl ClangItemParser for Item {
}
if let Some(ty) =
- ctx.builtin_or_resolved_ty(id, parent_id, ty, location) {
+ ctx.builtin_or_resolved_ty(id, parent_id, ty, location) {
return Ok(ty);
}
@@ -1133,10 +1134,9 @@ impl ClangItemParser for Item {
};
if valid_decl {
- if let Some(&(_, item_id)) =
- ctx.currently_parsed_types
- .iter()
- .find(|&&(d, _)| d == declaration_to_look_for) {
+ if let Some(&(_, item_id)) = ctx.currently_parsed_types
+ .iter()
+ .find(|&&(d, _)| d == declaration_to_look_for) {
debug!("Avoiding recursion parsing type: {:?}", ty);
return Ok(item_id);
}
diff --git a/libbindgen/src/ir/ty.rs b/libbindgen/src/ir/ty.rs
index 1c94ddf5..f1561612 100644
--- a/libbindgen/src/ir/ty.rs
+++ b/libbindgen/src/ir/ty.rs
@@ -324,8 +324,7 @@ impl CanDeriveDebug for Type {
fn can_derive_debug(&self, ctx: &BindgenContext, _: ()) -> bool {
match self.kind {
TypeKind::Array(t, len) => {
- len <= RUST_DERIVE_IN_ARRAY_LIMIT &&
- t.can_derive_debug(ctx, ())
+ len <= RUST_DERIVE_IN_ARRAY_LIMIT && t.can_derive_debug(ctx, ())
}
TypeKind::ResolvedTypeRef(t) |
TypeKind::TemplateAlias(_, t, _) |
@@ -351,7 +350,9 @@ impl<'a> CanDeriveCopy<'a> for Type {
TypeKind::TemplateAlias(_, t, _) |
TypeKind::TemplateRef(t, _) |
TypeKind::Alias(_, t) => t.can_derive_copy(ctx, ()),
- TypeKind::Comp(ref info) => info.can_derive_copy(ctx, (item, self.layout(ctx))),
+ TypeKind::Comp(ref info) => {
+ info.can_derive_copy(ctx, (item, self.layout(ctx)))
+ }
_ => true,
}
}
@@ -364,9 +365,7 @@ impl<'a> CanDeriveCopy<'a> for Type {
TypeKind::ResolvedTypeRef(t) |
TypeKind::TemplateAlias(_, t, _) |
TypeKind::Alias(_, t) |
- TypeKind::Array(t, _) => {
- t.can_derive_copy_in_array(ctx, ())
- }
+ TypeKind::Array(t, _) => t.can_derive_copy_in_array(ctx, ()),
TypeKind::Named(..) => false,
_ => self.can_derive_copy(ctx, item),
}
diff --git a/libbindgen/src/lib.rs b/libbindgen/src/lib.rs
index 5054cd13..372622d3 100644
--- a/libbindgen/src/lib.rs
+++ b/libbindgen/src/lib.rs
@@ -632,16 +632,16 @@ impl<'ctx> Bindings<'ctx> {
///
/// See the `uses` module for more information.
pub fn write_dummy_uses(&mut self) -> io::Result<()> {
- let file = if let Some(ref dummy_path) =
- self.context.options().dummy_uses {
- Some(try!(OpenOptions::new()
+ let file =
+ if let Some(ref dummy_path) = self.context.options().dummy_uses {
+ Some(try!(OpenOptions::new()
.write(true)
.truncate(true)
.create(true)
.open(dummy_path)))
- } else {
- None
- };
+ } else {
+ None
+ };
if let Some(file) = file {
try!(uses::generate_dummy_uses(&mut self.context, file));