Skip to content

Commit 904970e

Browse files
author
Rémy HUBSCHER
committed
Some cargo-fmt corrections.
1 parent 624c32c commit 904970e

File tree

4 files changed

+29
-16
lines changed

4 files changed

+29
-16
lines changed

src/bin/bindgen.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ extern crate log;
88
extern crate clang_sys;
99
extern crate rustc_serialize;
1010

11-
use bindgen::{BindgenOptions, Bindings, LinkType, ClangVersion, clang_version};
11+
use bindgen::{BindgenOptions, Bindings, ClangVersion, LinkType, clang_version};
1212
use std::default::Default;
1313
use std::env;
1414
use std::fs;
@@ -233,14 +233,20 @@ pub fn main() {
233233
let mut bind_args: Vec<_> = env::args().collect();
234234

235235
let version = clang_version();
236-
let expected_version = if cfg!(feature = "llvm_stable") { (3,8) } else { (3,9) };
236+
let expected_version = if cfg!(feature = "llvm_stable") {
237+
(3, 8)
238+
} else {
239+
(3, 9)
240+
};
237241

238242
info!("Clang Version: {}", version.full);
239243

240244
match version.parsed {
241245
None => warn!("Couldn't parse libclang version"),
242246
Some(version) if version != expected_version => {
243-
error!("Using clang {:?}, expected {:?}", version, expected_version);
247+
error!("Using clang {:?}, expected {:?}",
248+
version,
249+
expected_version);
244250
}
245251
_ => {}
246252
}

src/clang.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ impl Cursor {
285285
pub fn specialized(&self) -> Option<Cursor> {
286286
unsafe {
287287
let ret = Cursor {
288-
x: clang_getSpecializedCursorTemplate(self.x)
288+
x: clang_getSpecializedCursorTemplate(self.x),
289289
};
290290
if ret.is_valid() { Some(ret) } else { None }
291291
}

src/ir/item.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ pub trait ItemCanonicalPath {
4949
/// up to (but not including) the implicit root module.
5050
pub trait ItemAncestors {
5151
/// Get an iterable over this item's ancestors.
52-
fn ancestors<'a, 'b>(&self, ctx: &'a BindgenContext<'b>) -> ItemAncestorsIter<'a, 'b>;
52+
fn ancestors<'a, 'b>(&self,
53+
ctx: &'a BindgenContext<'b>)
54+
-> ItemAncestorsIter<'a, 'b>;
5355
}
5456

5557
/// An iterator over an item and its ancestors.

src/lib.rs

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -496,32 +496,37 @@ fn parse(context: &mut BindgenContext) {
496496
#[derive(Debug)]
497497
pub struct ClangVersion {
498498
/// Major and minor semvar, if parsing was successful
499-
pub parsed: Option<(u32,u32)>,
499+
pub parsed: Option<(u32, u32)>,
500500
/// full version string
501501
pub full: String,
502502
}
503503

504504
/// Get the major and the minor semvar numbers of Clang's version
505505
pub fn clang_version() -> ClangVersion {
506506
let raw_v: String = clang::extract_clang_version();
507-
let split_v: Option<Vec<&str>> = raw_v
508-
.split_whitespace()
507+
let split_v: Option<Vec<&str>> = raw_v.split_whitespace()
509508
.nth(2)
510509
.map(|v| v.split('.').collect());
511510
match split_v {
512511
Some(v) => {
513512
if v.len() >= 2 {
514513
let maybe_major = v[0].parse::<u32>();
515514
let maybe_minor = v[1].parse::<u32>();
516-
match (maybe_major,maybe_minor) {
517-
(Ok(major),Ok(minor)) => return ClangVersion { parsed: Some((major,minor)), full: raw_v.clone() },
518-
_ => {},
515+
match (maybe_major, maybe_minor) {
516+
(Ok(major), Ok(minor)) => {
517+
return ClangVersion {
518+
parsed: Some((major, minor)),
519+
full: raw_v.clone(),
520+
}
521+
}
522+
_ => {}
519523
}
520524
}
521-
},
522-
None => {},
525+
}
526+
None => {}
523527
};
524-
ClangVersion { parsed: None, full: raw_v.clone() }
528+
ClangVersion {
529+
parsed: None,
530+
full: raw_v.clone(),
531+
}
525532
}
526-
527-

0 commit comments

Comments
 (0)