diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-11-04 10:36:27 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-04 10:36:27 -0500 |
commit | d57362fbc223b25c4ddee8f59f5ba4daa0657c52 (patch) | |
tree | f902f665089ae35ef6b7ae13c39f002eff8b9c23 /src | |
parent | 624c32c93ccdd4ed34a6e827b063f272fbad36b0 (diff) | |
parent | 904970ec849d60613be9b46a510ccba7e16b6a35 (diff) |
Auto merge of #206 - Natim:fix-fmt, r=emilio
Some cargo-fmt corrections.
While running `cargo fmt` for my PR I realized that other files were touched.
Diffstat (limited to 'src')
-rwxr-xr-x | src/bin/bindgen.rs | 12 | ||||
-rwxr-xr-x | src/clang.rs | 2 | ||||
-rw-r--r-- | src/ir/item.rs | 4 | ||||
-rwxr-xr-x | src/lib.rs | 27 |
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. @@ -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(), + } } - - |