summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/bin/bindgen.rs12
-rwxr-xr-xsrc/clang.rs2
-rw-r--r--src/ir/item.rs4
-rwxr-xr-xsrc/lib.rs27
4 files changed, 29 insertions, 16 deletions
diff --git a/src/bin/bindgen.rs b/src/bin/bindgen.rs
index 2127ea49..c906efee 100755
--- a/src/bin/bindgen.rs
+++ b/src/bin/bindgen.rs
@@ -8,7 +8,7 @@ extern crate log;
extern crate clang_sys;
extern crate rustc_serialize;
-use bindgen::{BindgenOptions, Bindings, LinkType, ClangVersion, clang_version};
+use bindgen::{BindgenOptions, Bindings, ClangVersion, LinkType, clang_version};
use std::default::Default;
use std::env;
use std::fs;
@@ -233,14 +233,20 @@ pub fn main() {
let mut bind_args: Vec<_> = env::args().collect();
let version = clang_version();
- let expected_version = if cfg!(feature = "llvm_stable") { (3,8) } else { (3,9) };
+ let expected_version = if cfg!(feature = "llvm_stable") {
+ (3, 8)
+ } else {
+ (3, 9)
+ };
info!("Clang Version: {}", version.full);
match version.parsed {
None => warn!("Couldn't parse libclang version"),
Some(version) if version != expected_version => {
- error!("Using clang {:?}, expected {:?}", version, expected_version);
+ error!("Using clang {:?}, expected {:?}",
+ version,
+ expected_version);
}
_ => {}
}
diff --git a/src/clang.rs b/src/clang.rs
index b335a585..7702c660 100755
--- a/src/clang.rs
+++ b/src/clang.rs
@@ -285,7 +285,7 @@ impl Cursor {
pub fn specialized(&self) -> Option<Cursor> {
unsafe {
let ret = Cursor {
- x: clang_getSpecializedCursorTemplate(self.x)
+ x: clang_getSpecializedCursorTemplate(self.x),
};
if ret.is_valid() { Some(ret) } else { None }
}
diff --git a/src/ir/item.rs b/src/ir/item.rs
index 23090739..a9b625f2 100644
--- a/src/ir/item.rs
+++ b/src/ir/item.rs
@@ -49,7 +49,9 @@ pub trait ItemCanonicalPath {
/// up to (but not including) the implicit root module.
pub trait ItemAncestors {
/// Get an iterable over this item's ancestors.
- fn ancestors<'a, 'b>(&self, ctx: &'a BindgenContext<'b>) -> ItemAncestorsIter<'a, 'b>;
+ fn ancestors<'a, 'b>(&self,
+ ctx: &'a BindgenContext<'b>)
+ -> ItemAncestorsIter<'a, 'b>;
}
/// An iterator over an item and its ancestors.
diff --git a/src/lib.rs b/src/lib.rs
index 7fa8cf51..a0eba4c0 100755
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -496,7 +496,7 @@ fn parse(context: &mut BindgenContext) {
#[derive(Debug)]
pub struct ClangVersion {
/// Major and minor semvar, if parsing was successful
- pub parsed: Option<(u32,u32)>,
+ pub parsed: Option<(u32, u32)>,
/// full version string
pub full: String,
}
@@ -504,8 +504,7 @@ pub struct ClangVersion {
/// Get the major and the minor semvar numbers of Clang's version
pub fn clang_version() -> ClangVersion {
let raw_v: String = clang::extract_clang_version();
- let split_v: Option<Vec<&str>> = raw_v
- .split_whitespace()
+ let split_v: Option<Vec<&str>> = raw_v.split_whitespace()
.nth(2)
.map(|v| v.split('.').collect());
match split_v {
@@ -513,15 +512,21 @@ pub fn clang_version() -> ClangVersion {
if v.len() >= 2 {
let maybe_major = v[0].parse::<u32>();
let maybe_minor = v[1].parse::<u32>();
- match (maybe_major,maybe_minor) {
- (Ok(major),Ok(minor)) => return ClangVersion { parsed: Some((major,minor)), full: raw_v.clone() },
- _ => {},
+ match (maybe_major, maybe_minor) {
+ (Ok(major), Ok(minor)) => {
+ return ClangVersion {
+ parsed: Some((major, minor)),
+ full: raw_v.clone(),
+ }
+ }
+ _ => {}
}
}
- },
- None => {},
+ }
+ None => {}
};
- ClangVersion { parsed: None, full: raw_v.clone() }
+ ClangVersion {
+ parsed: None,
+ full: raw_v.clone(),
+ }
}
-
-