Run rustfmt (Rust 1.31.1)

This commit is contained in:
Oliver Hamlet
2018-12-22 22:50:16 +00:00
parent 5e1ba5709b
commit 9ef82fe886
6 changed files with 128 additions and 106 deletions
+10 -5
View File
@@ -45,7 +45,8 @@ fn criterion_benchmark(c: &mut Criterion) {
GameType::Tes4, GameType::Tes4,
"tests/testing-plugins/Oblivion/Data".into(), "tests/testing-plugins/Oblivion/Data".into(),
".".into(), ".".into(),
).with_active_plugins(&generate_active_plugins()); )
.with_active_plugins(&generate_active_plugins());
let expression = Expression::from_str("active(\"Blank.esm\")").unwrap(); let expression = Expression::from_str("active(\"Blank.esm\")").unwrap();
@@ -59,7 +60,8 @@ fn criterion_benchmark(c: &mut Criterion) {
GameType::Tes4, GameType::Tes4,
"tests/testing-plugins/Oblivion/Data".into(), "tests/testing-plugins/Oblivion/Data".into(),
".".into(), ".".into(),
).with_active_plugins(&generate_active_plugins()); )
.with_active_plugins(&generate_active_plugins());
let expression = Expression::from_str("active(\"Blank.*\")").unwrap(); let expression = Expression::from_str("active(\"Blank.*\")").unwrap();
@@ -82,7 +84,8 @@ fn criterion_benchmark(c: &mut Criterion) {
GameType::Tes4, GameType::Tes4,
"tests/testing-plugins/Oblivion/Data".into(), "tests/testing-plugins/Oblivion/Data".into(),
".".into(), ".".into(),
).with_active_plugins(&generate_active_plugins()); )
.with_active_plugins(&generate_active_plugins());
let expression = Expression::from_str("many_active(\"Blank.*\")").unwrap(); let expression = Expression::from_str("many_active(\"Blank.*\")").unwrap();
@@ -109,7 +112,8 @@ fn criterion_benchmark(c: &mut Criterion) {
GameType::Tes4, GameType::Tes4,
"tests/testing-plugins/Oblivion/Data".into(), "tests/testing-plugins/Oblivion/Data".into(),
".".into(), ".".into(),
).with_plugin_versions(&generate_plugin_versions()); )
.with_plugin_versions(&generate_plugin_versions());
let expression = Expression::from_str("version(\"Blank.esm\", \"5.0\", ==)").unwrap(); let expression = Expression::from_str("version(\"Blank.esm\", \"5.0\", ==)").unwrap();
@@ -122,7 +126,8 @@ fn criterion_benchmark(c: &mut Criterion) {
let state = State::new(GameType::Tes4, ".".into(), ".".into()); let state = State::new(GameType::Tes4, ".".into(), ".".into());
let expression = Expression::from_str( let expression = Expression::from_str(
"version(\"tests/loot_api_win32/loot_api.dll\", \"0.13.8.0\", ==)", "version(\"tests/loot_api_win32/loot_api.dll\", \"0.13.8.0\", ==)",
).unwrap(); )
.unwrap();
b.iter(|| { b.iter(|| {
assert!(expression.eval(&state).unwrap()); assert!(expression.eval(&state).unwrap());
+6 -3
View File
@@ -38,7 +38,8 @@ pub unsafe extern "C" fn lci_condition_parse(condition: *const c_char) -> c_int
LCI_OK LCI_OK
} }
} }
}).unwrap_or(LCI_ERROR_PANICKED) })
.unwrap_or(LCI_ERROR_PANICKED)
} }
#[no_mangle] #[no_mangle]
@@ -71,7 +72,8 @@ pub unsafe extern "C" fn lci_condition_eval(
Err(e) => handle_error(e), Err(e) => handle_error(e),
} }
} }
}).unwrap_or(LCI_ERROR_PANICKED) })
.unwrap_or(LCI_ERROR_PANICKED)
} }
#[no_mangle] #[no_mangle]
@@ -90,5 +92,6 @@ pub unsafe extern "C" fn lci_get_error_message(message: *mut *const c_char) -> c
LCI_OK LCI_OK
} }
}).unwrap_or(LCI_ERROR_PANICKED) })
.unwrap_or(LCI_ERROR_PANICKED)
} }
+10 -5
View File
@@ -61,7 +61,8 @@ pub unsafe extern "C" fn lci_state_create(
LCI_OK LCI_OK
} }
}).unwrap_or(LCI_ERROR_PANICKED) })
.unwrap_or(LCI_ERROR_PANICKED)
} }
#[no_mangle] #[no_mangle]
@@ -105,7 +106,8 @@ pub unsafe extern "C" fn lci_state_set_active_plugins(
LCI_OK LCI_OK
} }
}).unwrap_or(LCI_ERROR_PANICKED) })
.unwrap_or(LCI_ERROR_PANICKED)
} }
#[no_mangle] #[no_mangle]
@@ -142,7 +144,8 @@ pub unsafe extern "C" fn lci_state_set_plugin_versions(
LCI_OK LCI_OK
} }
}).unwrap_or(LCI_ERROR_PANICKED) })
.unwrap_or(LCI_ERROR_PANICKED)
} }
#[no_mangle] #[no_mangle]
@@ -178,7 +181,8 @@ pub unsafe extern "C" fn lci_state_set_crc_cache(
}, },
} }
} }
}).unwrap_or(LCI_ERROR_PANICKED) })
.unwrap_or(LCI_ERROR_PANICKED)
} }
#[no_mangle] #[no_mangle]
@@ -195,5 +199,6 @@ pub unsafe extern "C" fn lci_state_clear_condition_cache(state: *mut lci_state)
}, },
} }
} }
}).unwrap_or(LCI_ERROR_PANICKED) })
.unwrap_or(LCI_ERROR_PANICKED)
} }
+12 -6
View File
@@ -347,7 +347,8 @@ mod tests {
copy( copy(
Path::new("tests/testing-plugins/Oblivion/Data/Blank.esp"), Path::new("tests/testing-plugins/Oblivion/Data/Blank.esp"),
&state.data_path.join("Blank.esp.ghost"), &state.data_path.join("Blank.esp.ghost"),
).unwrap(); )
.unwrap();
let function = Function::FilePath(PathBuf::from("Blank.esp")); let function = Function::FilePath(PathBuf::from("Blank.esp"));
@@ -381,7 +382,8 @@ mod tests {
copy( copy(
Path::new("Cargo.toml"), Path::new("Cargo.toml"),
&state.data_path.join("Cargo.toml.ghost"), &state.data_path.join("Cargo.toml.ghost"),
).unwrap(); )
.unwrap();
let function = Function::FilePath(PathBuf::from("Cargo.toml")); let function = Function::FilePath(PathBuf::from("Cargo.toml"));
@@ -565,7 +567,8 @@ mod tests {
copy( copy(
Path::new("tests/testing-plugins/Oblivion/Data/Blank.esm"), Path::new("tests/testing-plugins/Oblivion/Data/Blank.esm"),
&state.data_path.join("Blank.esm.ghost"), &state.data_path.join("Blank.esm.ghost"),
).unwrap(); )
.unwrap();
let function = Function::Checksum(PathBuf::from("Blank.esm"), 0x374E2A6F); let function = Function::Checksum(PathBuf::from("Blank.esm"), 0x374E2A6F);
@@ -581,7 +584,8 @@ mod tests {
copy( copy(
Path::new("tests/testing-plugins/Oblivion/Data/Blank.bsa"), Path::new("tests/testing-plugins/Oblivion/Data/Blank.bsa"),
&state.data_path.join("Blank.bsa.ghost"), &state.data_path.join("Blank.bsa.ghost"),
).unwrap(); )
.unwrap();
let function = Function::Checksum(PathBuf::from("Blank.bsa"), 0x22AB79D9); let function = Function::Checksum(PathBuf::from("Blank.bsa"), 0x22AB79D9);
@@ -615,7 +619,8 @@ mod tests {
copy( copy(
Path::new("tests/testing-plugins/Oblivion/Data/Blank.esm"), Path::new("tests/testing-plugins/Oblivion/Data/Blank.esm"),
&state.data_path.join("Blank.esm"), &state.data_path.join("Blank.esm"),
).unwrap(); )
.unwrap();
let function = Function::Checksum(PathBuf::from("Blank.esm"), 0x374E2A6F); let function = Function::Checksum(PathBuf::from("Blank.esm"), 0x374E2A6F);
@@ -625,7 +630,8 @@ mod tests {
copy( copy(
Path::new("tests/testing-plugins/Oblivion/Data/Blank.bsa"), Path::new("tests/testing-plugins/Oblivion/Data/Blank.bsa"),
&state.data_path.join("Blank.esm"), &state.data_path.join("Blank.esm"),
).unwrap(); )
.unwrap();
let function = Function::Checksum(PathBuf::from("Blank.esm"), 0x374E2A6F); let function = Function::Checksum(PathBuf::from("Blank.esm"), 0x374E2A6F);
+4 -2
View File
@@ -21,7 +21,8 @@ impl ComparisonOperator {
tag!(">=") => { |_| ComparisonOperator::GreaterThanOrEqual } | tag!(">=") => { |_| ComparisonOperator::GreaterThanOrEqual } |
tag!("<") => { |_| ComparisonOperator::LessThan } | tag!("<") => { |_| ComparisonOperator::LessThan } |
tag!(">") => { |_| ComparisonOperator::GreaterThan } tag!(">") => { |_| ComparisonOperator::GreaterThan }
) >> (operator) )
>> (operator)
) )
} }
} }
@@ -247,7 +248,8 @@ impl Function {
) => { ) => {
|(path, crc)| Function::Checksum(path, crc) |(path, crc)| Function::Checksum(path, crc)
} }
) >> (function) )
>> (function)
) )
} }
} }
+2 -1
View File
@@ -246,7 +246,8 @@ impl Condition {
delimited!(fix_error!(ParsingError, ws!(tag!("("))), call!(parse_expression), fix_error!(ParsingError, ws!(tag!(")")))) => { delimited!(fix_error!(ParsingError, ws!(tag!("("))), call!(parse_expression), fix_error!(ParsingError, ws!(tag!(")")))) => {
|e| Condition::Expression(e) |e| Condition::Expression(e)
} }
) >> (condition) )
>> (condition)
) )
} }
} }