From e57d716e5c88057b652fe52d4fc6f6518b4758e1 Mon Sep 17 00:00:00 2001 From: kpcyrd Date: Thu, 6 May 2021 17:37:28 +0200 Subject: Update to rust 2018 edition --- Cargo.toml | 1 + examples/glob/Cargo.toml | 1 + examples/glob/src/main.rs | 3 --- examples/global/Cargo.toml | 1 + examples/hierarchical-env/Cargo.toml | 1 + examples/hierarchical-env/src/settings.rs | 2 +- examples/simple/Cargo.toml | 1 + examples/simple/src/main.rs | 2 -- examples/watch/Cargo.toml | 1 + examples/watch/src/main.rs | 8 +------- src/error.rs | 1 - src/file/format/hjson.rs | 2 -- src/file/format/json.rs | 2 -- src/file/format/ron.rs | 2 -- src/file/format/toml.rs | 2 -- src/lib.rs | 12 ++++++------ 16 files changed, 14 insertions(+), 28 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 040124f..abec5bd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,7 @@ keywords = ["config", "configuration", "settings", "env", "environment"] authors = ["Ryan Leckey "] categories = ["config"] license = "MIT/Apache-2.0" +edition = "2018" [badges] maintenance = { status = "actively-developed" } diff --git a/examples/glob/Cargo.toml b/examples/glob/Cargo.toml index c4b042e..32b7ba3 100644 --- a/examples/glob/Cargo.toml +++ b/examples/glob/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "glob" version = "0.1.0" +edition = "2018" [dependencies] config = { path = "../../" } diff --git a/examples/glob/src/main.rs b/examples/glob/src/main.rs index 112335c..b3183ef 100644 --- a/examples/glob/src/main.rs +++ b/examples/glob/src/main.rs @@ -1,6 +1,3 @@ -extern crate glob; -extern crate config; - use std::path::Path; use std::collections::HashMap; use config::*; diff --git a/examples/global/Cargo.toml b/examples/global/Cargo.toml index ec24740..dacbfe2 100644 --- a/examples/global/Cargo.toml +++ b/examples/global/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "global" version = "0.1.0" +edition = "2018" [dependencies] config = { path = "../../" } diff --git a/examples/hierarchical-env/Cargo.toml b/examples/hierarchical-env/Cargo.toml index bbcd4a6..421d10d 100644 --- a/examples/hierarchical-env/Cargo.toml +++ b/examples/hierarchical-env/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "hierarchical-env" version = "0.1.0" +edition = "2018" [dependencies] config = { path = "../../" } diff --git a/examples/hierarchical-env/src/settings.rs b/examples/hierarchical-env/src/settings.rs index ad23163..0fa59d2 100644 --- a/examples/hierarchical-env/src/settings.rs +++ b/examples/hierarchical-env/src/settings.rs @@ -38,7 +38,7 @@ pub struct Settings { impl Settings { pub fn new() -> Result { - let mut s = Config::new(); + let mut s = Config::default(); // Start off by merging in the "default" configuration file s.merge(File::with_name("config/default"))?; diff --git a/examples/simple/Cargo.toml b/examples/simple/Cargo.toml index 196f742..f1d8097 100644 --- a/examples/simple/Cargo.toml +++ b/examples/simple/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "simple" version = "0.1.0" +edition = "2018" [dependencies] config = { path = "../../" } diff --git a/examples/simple/src/main.rs b/examples/simple/src/main.rs index 7e7ca31..1c7ddb7 100644 --- a/examples/simple/src/main.rs +++ b/examples/simple/src/main.rs @@ -1,5 +1,3 @@ -extern crate config; - use std::collections::HashMap; fn main() { diff --git a/examples/watch/Cargo.toml b/examples/watch/Cargo.toml index 8c8a505..36b2880 100644 --- a/examples/watch/Cargo.toml +++ b/examples/watch/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "watch" version = "0.1.0" +edition = "2018" [dependencies] config = { path = "../../" } diff --git a/examples/watch/src/main.rs b/examples/watch/src/main.rs index 3f08e94..a197390 100644 --- a/examples/watch/src/main.rs +++ b/examples/watch/src/main.rs @@ -1,9 +1,3 @@ -extern crate config; -extern crate notify; - -#[macro_use] -extern crate lazy_static; - use config::*; use std::collections::HashMap; use std::sync::RwLock; @@ -11,7 +5,7 @@ use notify::{RecommendedWatcher, DebouncedEvent, Watcher, RecursiveMode}; use std::sync::mpsc::channel; use std::time::Duration; -lazy_static! { +lazy_static::lazy_static! { static ref SETTINGS: RwLock = RwLock::new({ let mut settings = Config::default(); settings.merge(File::with_name("Settings.toml")).unwrap(); diff --git a/src/error.rs b/src/error.rs index c7578d8..28142b5 100644 --- a/src/error.rs +++ b/src/error.rs @@ -2,7 +2,6 @@ use std::error::Error; use std::fmt; use std::result; -use nom; use serde::de; use serde::ser; diff --git a/src/file/format/hjson.rs b/src/file/format/hjson.rs index 8a1e474..f94b1d3 100644 --- a/src/file/format/hjson.rs +++ b/src/file/format/hjson.rs @@ -1,8 +1,6 @@ use std::collections::HashMap; use std::error::Error; -use serde_hjson; - use crate::value::{Value, ValueKind}; pub fn parse( diff --git a/src/file/format/json.rs b/src/file/format/json.rs index 568a16b..87a6e61 100644 --- a/src/file/format/json.rs +++ b/src/file/format/json.rs @@ -1,8 +1,6 @@ use std::collections::HashMap; use std::error::Error; -use serde_json; - use crate::value::{Value, ValueKind}; pub fn parse( diff --git a/src/file/format/ron.rs b/src/file/format/ron.rs index d3a97cb..f7dbce3 100644 --- a/src/file/format/ron.rs +++ b/src/file/format/ron.rs @@ -1,8 +1,6 @@ use std::collections::HashMap; use std::error::Error; -use ron; - use crate::value::{Value, ValueKind}; pub fn parse( diff --git a/src/file/format/toml.rs b/src/file/format/toml.rs index c5b7a7d..c7c5972 100644 --- a/src/file/format/toml.rs +++ b/src/file/format/toml.rs @@ -1,8 +1,6 @@ use std::collections::HashMap; use std::error::Error; -use toml; - use crate::value::{Value, ValueKind}; pub fn parse( diff --git a/src/lib.rs b/src/lib.rs index 03a82c1..2dbd7b8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -61,9 +61,9 @@ mod ser; mod source; mod value; -pub use config::Config; -pub use env::Environment; -pub use error::ConfigError; -pub use file::{File, FileFormat, FileSourceFile, FileSourceString}; -pub use source::Source; -pub use value::Value; +pub use crate::config::Config; +pub use crate::env::Environment; +pub use crate::error::ConfigError; +pub use crate::file::{File, FileFormat, FileSourceFile, FileSourceString}; +pub use crate::source::Source; +pub use crate::value::Value; -- cgit v1.2.3