diff --git a/src/bin/rust_qt_binding_generator.rs b/src/bin/rust_qt_binding_generator.rs index 2117e80..8683a21 100644 --- a/src/bin/rust_qt_binding_generator.rs +++ b/src/bin/rust_qt_binding_generator.rs @@ -11,13 +11,15 @@ fn main() { Arg::with_name("overwrite-implementation") .long("overwrite-implementation") .help("Overwrite existing implementation."), - ).arg( + ) + .arg( Arg::with_name("config") .multiple(true) .required(true) .takes_value(true) .help("Configuration file(s)"), - ).get_matches(); + ) + .get_matches(); let overwrite_implementation = matches.is_present("overwrite-implementation"); for config in matches.values_of("config").unwrap() { diff --git a/src/configuration.rs b/src/configuration.rs index 1b3790b..efeead1 100644 --- a/src/configuration.rs +++ b/src/configuration.rs @@ -1,11 +1,11 @@ use configuration_private::*; use serde_json; -use toml; use std::collections::{BTreeMap, BTreeSet}; use std::error::Error; use std::fs; use std::path::{Path, PathBuf}; use std::rc::Rc; +use toml; mod json { use super::Rust; @@ -61,7 +61,7 @@ mod json { pub enum RustEdition { Rust2015, Rust2018, - Unknown + Unknown, } impl<'a> ::std::convert::From> for RustEdition { @@ -471,7 +471,10 @@ fn post_process(config_file: &Path, json: json::Config) -> Result bool { o.item_properties .values() - .any(|ip|ip.write && (col == 0 || (ip.roles.len() > col && !ip.roles[col].is_empty()))) + .any(|ip| ip.write && (col == 0 || (ip.roles.len() > col && !ip.roles[col].is_empty()))) } fn write_function_c_decl( diff --git a/src/lib.rs b/src/lib.rs index 9718e4e..acca2b8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,14 +12,12 @@ mod cpp; mod rust; mod util; +use configuration::Config; use std::error::Error; use std::path::Path; -use configuration::Config; /// Read a file with bindings. -pub fn read_bindings_file>( - config_file: P, -) -> Result> { +pub fn read_bindings_file>(config_file: P) -> Result> { configuration::parse(config_file) } diff --git a/src/rust.rs b/src/rust.rs index 771dcf4..a56378f 100644 --- a/src/rust.rs +++ b/src/rust.rs @@ -335,7 +335,9 @@ impl {0}Emitter {{ /// reference. That is undefined behaviour and forbidden. pub fn clone(&mut self) -> {0}Emitter {{ {0}Emitter {{ - qobject: self.qobject.clone(),", o.name)?; + qobject: self.qobject.clone(),", + o.name + )?; for (name, p) in &o.properties { if p.is_object() { continue; @@ -1540,6 +1542,6 @@ use {}{}::*; fn get_module_prefix(conf: &Config) -> &'static str { match conf.rust_edition { RustEdition::Rust2018 => "crate::", - _ => "" + _ => "", } }