Update to Rust 2018 syntax

This commit is contained in:
Oliver Hamlet
2019-06-30 11:25:23 +01:00
parent 6cfefc6c31
commit 52792626af
8 changed files with 14 additions and 22 deletions
+1
View File
@@ -3,6 +3,7 @@ name = "loot-condition-interpreter"
version = "1.3.0" version = "1.3.0"
authors = ["Oliver Hamlet <oliver.hamlet@gmail.com>"] authors = ["Oliver Hamlet <oliver.hamlet@gmail.com>"]
license = "MIT" license = "MIT"
edition = "2018"
[dependencies] [dependencies]
crc = "1.0.0" crc = "1.0.0"
+1
View File
@@ -4,6 +4,7 @@ version = "1.3.0"
authors = ["Oliver Hamlet <oliver.hamlet@gmail.com>"] authors = ["Oliver Hamlet <oliver.hamlet@gmail.com>"]
license = "MIT" license = "MIT"
build = "build.rs" build = "build.rs"
edition = "2018"
[dependencies] [dependencies]
loot-condition-interpreter = { path = ".." } loot-condition-interpreter = { path = ".." }
+2 -2
View File
@@ -5,8 +5,8 @@ use libc::{c_char, c_int, size_t};
use loot_condition_interpreter::{Error, GameType}; use loot_condition_interpreter::{Error, GameType};
use super::ERROR_MESSAGE; use super::ERROR_MESSAGE;
use constants::*; use crate::constants::*;
use state::{plugin_crc, plugin_version}; use crate::state::{plugin_crc, plugin_version};
pub fn error(code: c_int, message: &str) -> c_int { pub fn error(code: c_int, message: &str) -> c_int {
ERROR_MESSAGE.with(|f| { ERROR_MESSAGE.with(|f| {
+4 -2
View File
@@ -6,8 +6,10 @@ use std::sync::RwLock;
use libc::{c_char, c_int, size_t}; use libc::{c_char, c_int, size_t};
use loot_condition_interpreter::State; use loot_condition_interpreter::State;
use constants::*; use crate::constants::*;
use helpers::{error, map_game_type, map_plugin_crcs, map_plugin_versions, to_str, to_str_vec}; use crate::helpers::{
error, map_game_type, map_plugin_crcs, map_plugin_versions, to_str, to_str_vec,
};
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
#[no_mangle] #[no_mangle]
+3 -4
View File
@@ -8,9 +8,8 @@ use crc::{crc32, Hasher32};
use regex::Regex; use regex::Regex;
use super::{ComparisonOperator, Function}; use super::{ComparisonOperator, Function};
use version::Version; use crate::version::Version;
use Error; use crate::{Error, State};
use State;
fn add_extension(path: &Path, extension: &str) -> PathBuf { fn add_extension(path: &Path, extension: &str) -> PathBuf {
match path.extension() { match path.extension() {
@@ -274,7 +273,7 @@ mod tests {
use regex::RegexBuilder; use regex::RegexBuilder;
use tempfile::tempdir; use tempfile::tempdir;
use GameType; use crate::GameType;
fn state<T: Into<PathBuf>>(data_path: T) -> State { fn state<T: Into<PathBuf>>(data_path: T) -> State {
state_with_active_plugins(data_path, &[]) state_with_active_plugins(data_path, &[])
+2 -4
View File
@@ -10,10 +10,8 @@ use nom::{Err, IResult};
use regex::{Regex, RegexBuilder}; use regex::{Regex, RegexBuilder};
use super::{ComparisonOperator, Function}; use super::{ComparisonOperator, Function};
use crate::{map_err, whitespace}; use crate::error::ParsingErrorKind;
use error::ParsingErrorKind; use crate::{map_err, whitespace, ParsingError, ParsingResult};
use ParsingError;
use ParsingResult;
impl ComparisonOperator { impl ComparisonOperator {
pub fn parse(input: &str) -> IResult<&str, ComparisonOperator> { pub fn parse(input: &str) -> IResult<&str, ComparisonOperator> {
-9
View File
@@ -1,12 +1,3 @@
extern crate crc;
extern crate nom;
extern crate pelite;
extern crate regex;
extern crate unicase;
#[cfg(test)]
extern crate tempfile;
mod error; mod error;
mod function; mod function;
mod version; mod version;
+1 -1
View File
@@ -5,7 +5,7 @@ use pelite::resources::version_info::VersionInfo;
use pelite::resources::{FindError, Resources}; use pelite::resources::{FindError, Resources};
use pelite::FileMap; use pelite::FileMap;
use error::Error; use crate::error::Error;
const VERSION_INFO_RESOURCE_PATH: &str = "/16/1"; const VERSION_INFO_RESOURCE_PATH: &str = "/16/1";