diff --git a/src/bin/bindgen.rs b/src/bin/bindgen.rs index 2127ea4913..c906efee27 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 b335a58555..7702c66036 100755 --- a/src/clang.rs +++ b/src/clang.rs @@ -285,7 +285,7 @@ impl Cursor { pub fn specialized(&self) -> Option { 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 230907393e..a9b625f20d 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 7fa8cf5133..a0eba4c088 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> = raw_v - .split_whitespace() + let split_v: Option> = 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::(); let maybe_minor = v[1].parse::(); - 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(), + } } - -