summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs34
1 files changed, 18 insertions, 16 deletions
diff --git a/src/main.rs b/src/main.rs
index 32248cb0..dc3572b3 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,8 +1,8 @@
extern crate bindgen;
-#[cfg(feature="logging")]
+#[cfg(feature = "logging")]
extern crate env_logger;
#[macro_use]
-#[cfg(feature="logging")]
+#[cfg(feature = "logging")]
extern crate log;
extern crate clang_sys;
extern crate clap;
@@ -12,21 +12,20 @@ use std::env;
use std::panic;
#[macro_use]
-#[cfg(not(feature="logging"))]
+#[cfg(not(feature = "logging"))]
mod log_stubs;
mod options;
use options::builder_from_flags;
pub fn main() {
- #[cfg(feature="logging")]
+ #[cfg(feature = "logging")]
log::set_logger(|max_log_level| {
- use env_logger::Logger;
- let env_logger = Logger::new();
- max_log_level.set(env_logger.filter());
- Box::new(env_logger)
- })
- .expect("Failed to set logger.");
+ use env_logger::Logger;
+ let env_logger = Logger::new();
+ max_log_level.set(env_logger.filter());
+ Box::new(env_logger)
+ }).expect("Failed to set logger.");
let bind_args: Vec<_> = env::args().collect();
@@ -65,8 +64,7 @@ pub fn main() {
}
let bindings = builder_result.unwrap();
- bindings.write(output)
- .expect("Unable to write output");
+ bindings.write(output).expect("Unable to write output");
}
Err(error) => {
println!("{}", error);
@@ -77,10 +75,14 @@ pub fn main() {
fn print_verbose_err() {
println!("Bindgen unexpectedly panicked");
- println!("This may be caused by one of the known-unsupported \
+ println!(
+ "This may be caused by one of the known-unsupported \
things (https://github.com/rust-lang-nursery/rust-bindgen#c), \
please modify the bindgen flags to work around it as \
- described in https://github.com/rust-lang-nursery/rust-bindgen#c");
- println!("Otherwise, please file an issue at \
- https://github.com/rust-lang-nursery/rust-bindgen/issues/new");
+ described in https://github.com/rust-lang-nursery/rust-bindgen#c"
+ );
+ println!(
+ "Otherwise, please file an issue at \
+ https://github.com/rust-lang-nursery/rust-bindgen/issues/new"
+ );
}