cargo fmt

master
Jos van den Oever 2019-01-22 00:03:50 +01:00
parent 1e4d769b32
commit ad94fb1036
5 changed files with 19 additions and 13 deletions

View File

@ -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() {

View File

@ -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<Option<&'a str>> for RustEdition {
@ -471,7 +471,10 @@ fn post_process(config_file: &Path, json: json::Config) -> Result<Config, Box<Er
buf.pop();
buf.push("Cargo.toml");
let manifest: toml::Value = fs::read_to_string(&buf)?.parse()?;
manifest["package"].get("edition").and_then(|val| val.as_str()).into()
manifest["package"]
.get("edition")
.and_then(|val| val.as_str())
.into()
};
Ok(Config {

View File

@ -149,7 +149,8 @@ private:"
"QVariant"
} else {
p.type_name()
}.to_string();
}
.to_string();
if p.is_object() {
t.push_str("*");
}
@ -213,7 +214,7 @@ public:
fn is_column_write(o: &Object, col: usize) -> 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(

View File

@ -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<P: AsRef<Path>>(
config_file: P,
) -> Result<Config, Box<Error>> {
pub fn read_bindings_file<P: AsRef<Path>>(config_file: P) -> Result<Config, Box<Error>> {
configuration::parse(config_file)
}

View File

@ -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::",
_ => ""
_ => "",
}
}