0 | |
diff --git a/Cargo.toml b/Cargo.toml
|
1 | |
index 751911f..3a5a5a9 100644
|
2 | 0 |
--- a/Cargo.toml
|
3 | 1 |
+++ b/Cargo.toml
|
4 | |
@@ -28,17 +28,12 @@ version = "1.0"
|
5 | |
version = "5.0.0"
|
6 | |
|
7 | |
[dependencies.rust-ini]
|
8 | |
-version = "0.13"
|
9 | |
+version = "0.16"
|
10 | |
optional = true
|
11 | |
|
12 | |
[dependencies.serde]
|
13 | |
version = "1.0.8"
|
|
2 |
@@ -36,7 +36,2 @@
|
14 | 3 |
|
15 | 4 |
-[dependencies.serde-hjson]
|
16 | 5 |
-version = "0.9"
|
|
18 | 7 |
-default-features = false
|
19 | 8 |
-
|
20 | 9 |
[dependencies.serde_json]
|
21 | |
version = "1.0.2"
|
22 | |
optional = true
|
23 | |
@@ -61,8 +56,7 @@ version = "0.6"
|
24 | |
version = "1.0.8"
|
25 | |
|
|
10 |
@@ -63,4 +58,3 @@
|
26 | 11 |
[features]
|
27 | 12 |
-default = ["toml", "json", "yaml", "hjson", "ini"]
|
28 | 13 |
-hjson = ["serde-hjson"]
|
29 | 14 |
+default = ["toml", "json", "yaml", "ini"]
|
30 | 15 |
ini = ["rust-ini"]
|
31 | |
json = ["serde_json"]
|
32 | |
yaml = ["yaml-rust"]
|
33 | |
diff --git a/src/file/format/hjson.rs b/src/file/format/hjson.rs
|
34 | |
deleted file mode 100644
|
35 | |
index 457cfbf..0000000
|
36 | 16 |
--- a/src/file/format/hjson.rs
|
37 | 17 |
+++ /dev/null
|
38 | 18 |
@@ -1,55 +0,0 @@
|
|
91 | 71 |
- serde_hjson::Value::Null => Value::new(uri, ValueKind::Nil),
|
92 | 72 |
- }
|
93 | 73 |
-}
|
94 | |
diff --git a/src/file/format/ini.rs b/src/file/format/ini.rs
|
95 | |
index e5a109f..4395c45 100644
|
96 | 74 |
--- a/src/file/format/ini.rs
|
97 | 75 |
+++ b/src/file/format/ini.rs
|
98 | |
@@ -11,17 +11,17 @@ pub fn parse(
|
99 | |
let mut map: HashMap<String, Value> = HashMap::new();
|
100 | |
let i = Ini::load_from_str(text)?;
|
|
76 |
@@ -13,3 +13,3 @@
|
101 | 77 |
for (sec, prop) in i.iter() {
|
102 | 78 |
- match *sec {
|
103 | 79 |
+ match sec {
|
104 | 80 |
Some(ref sec) => {
|
105 | |
let mut sec_map: HashMap<String, Value> = HashMap::new();
|
|
81 |
@@ -17,5 +17,5 @@
|
106 | 82 |
for (k, v) in prop.iter() {
|
107 | 83 |
- sec_map.insert(k.clone(), Value::new(uri, ValueKind::String(v.clone())));
|
108 | 84 |
+ sec_map.insert(k.to_owned(), Value::new(uri, ValueKind::String(v.to_owned())));
|
|
110 | 86 |
- map.insert(sec.clone(), Value::new(uri, ValueKind::Table(sec_map)));
|
111 | 87 |
+ map.insert((*sec).to_owned(), Value::new(uri, ValueKind::Table(sec_map)));
|
112 | 88 |
}
|
113 | |
None => {
|
|
89 |
@@ -23,3 +23,3 @@
|
114 | 90 |
for (k, v) in prop.iter() {
|
115 | 91 |
- map.insert(k.clone(), Value::new(uri, ValueKind::String(v.clone())));
|
116 | 92 |
+ map.insert(k.to_owned(), Value::new(uri, ValueKind::String(v.to_owned())));
|
117 | 93 |
}
|
118 | |
}
|
119 | |
}
|
120 | |
diff --git a/src/file/format/mod.rs b/src/file/format/mod.rs
|
121 | |
index f46ae13..819644f 100644
|
122 | 94 |
--- a/src/file/format/mod.rs
|
123 | 95 |
+++ b/src/file/format/mod.rs
|
124 | |
@@ -16,9 +16,6 @@ mod json;
|
125 | |
#[cfg(feature = "yaml")]
|
126 | |
mod yaml;
|
|
96 |
@@ -18,5 +18,2 @@
|
127 | 97 |
|
128 | 98 |
-#[cfg(feature = "hjson")]
|
129 | 99 |
-mod hjson;
|
130 | 100 |
-
|
131 | 101 |
#[cfg(feature = "ini")]
|
132 | |
mod ini;
|
133 | |
|
134 | |
@@ -36,9 +33,6 @@ pub enum FileFormat {
|
135 | |
#[cfg(feature = "yaml")]
|
136 | |
Yaml,
|
|
102 |
@@ -38,5 +35,2 @@
|
137 | 103 |
|
138 | 104 |
- /// HJSON (parsed with serde_hjson)
|
139 | 105 |
- #[cfg(feature = "hjson")]
|
140 | 106 |
- Hjson,
|
141 | 107 |
/// INI (parsed with rust_ini)
|
142 | |
#[cfg(feature = "ini")]
|
143 | |
Ini,
|
144 | |
@@ -59,9 +53,6 @@ lazy_static! {
|
145 | |
#[cfg(feature = "yaml")]
|
146 | |
formats.insert(FileFormat::Yaml, vec!["yaml", "yml"]);
|
|
108 |
@@ -61,5 +55,2 @@
|
147 | 109 |
|
148 | 110 |
- #[cfg(feature = "hjson")]
|
149 | 111 |
- formats.insert(FileFormat::Hjson, vec!["hjson"]);
|
150 | 112 |
-
|
151 | 113 |
#[cfg(feature = "ini")]
|
152 | |
formats.insert(FileFormat::Ini, vec!["ini"]);
|
153 | |
|
154 | |
@@ -97,9 +88,6 @@ impl FileFormat {
|
155 | |
#[cfg(feature = "yaml")]
|
156 | |
FileFormat::Yaml => yaml::parse(uri, text),
|
|
114 |
@@ -99,5 +90,2 @@
|
157 | 115 |
|
158 | 116 |
- #[cfg(feature = "hjson")]
|
159 | 117 |
- FileFormat::Hjson => hjson::parse(uri, text),
|
160 | 118 |
-
|
161 | 119 |
#[cfg(feature = "ini")]
|
162 | |
FileFormat::Ini => ini::parse(uri, text),
|
163 | |
}
|
164 | |
diff --git a/src/lib.rs b/src/lib.rs
|
165 | |
index a47a671..6f0079c 100644
|
166 | 120 |
--- a/src/lib.rs
|
167 | 121 |
+++ b/src/lib.rs
|
168 | |
@@ -45,9 +45,6 @@ extern crate serde_json;
|
169 | |
#[cfg(feature = "yaml")]
|
170 | |
extern crate yaml_rust;
|
|
122 |
@@ -47,5 +47,2 @@
|
171 | 123 |
|
172 | 124 |
-#[cfg(feature = "hjson")]
|
173 | 125 |
-extern crate serde_hjson;
|
174 | 126 |
-
|
175 | 127 |
#[cfg(feature = "ini")]
|
176 | |
extern crate ini;
|
177 | |
|
178 | |
diff --git a/tests/Settings-invalid.hjson b/tests/Settings-invalid.hjson
|
179 | |
deleted file mode 100644
|
180 | |
index 7e31ec3..0000000
|
181 | 128 |
--- a/tests/Settings-invalid.hjson
|
182 | 129 |
+++ /dev/null
|
183 | 130 |
@@ -1,4 +0,0 @@
|
|
185 | 132 |
- ok: true,
|
186 | 133 |
- error
|
187 | 134 |
-}
|
188 | |
diff --git a/tests/Settings.hjson b/tests/Settings.hjson
|
189 | |
deleted file mode 100644
|
190 | |
index 3e04ccf..0000000
|
191 | 135 |
--- a/tests/Settings.hjson
|
192 | 136 |
+++ /dev/null
|
193 | 137 |
@@ -1,16 +0,0 @@
|
|
207 | 151 |
- }
|
208 | 152 |
- }
|
209 | 153 |
-}
|
210 | |
diff --git a/tests/datetime.rs b/tests/datetime.rs
|
211 | |
index 6c1e620..7ee8ec3 100644
|
212 | 154 |
--- a/tests/datetime.rs
|
213 | 155 |
+++ b/tests/datetime.rs
|
214 | |
@@ -1,7 +1,6 @@
|
215 | |
#![cfg(all(
|
216 | |
feature = "toml",
|
|
156 |
@@ -3,3 +3,2 @@
|
217 | 157 |
feature = "json",
|
218 | 158 |
- feature = "hjson",
|
219 | 159 |
feature = "yaml",
|
220 | |
feature = "ini",
|
221 | |
))]
|
222 | |
@@ -37,15 +36,6 @@ fn make() -> Config {
|
223 | |
FileFormat::Toml,
|
224 | |
))
|
225 | |
.unwrap()
|
226 | |
- .merge(File::from_str(
|
227 | |
- r#"
|
|
160 |
@@ -41,11 +40,2 @@
|
|
161 |
r#"
|
228 | 162 |
- {
|
229 | 163 |
- "hjson_datetime": "2017-05-10T02:14:53Z"
|
230 | 164 |
- }
|
|
232 | 166 |
- FileFormat::Hjson,
|
233 | 167 |
- ))
|
234 | 168 |
- .unwrap()
|
235 | |
.merge(File::from_str(
|
236 | |
r#"
|
|
169 |
- .merge(File::from_str(
|
|
170 |
- r#"
|
237 | 171 |
ini_datetime = 2017-05-10T02:14:53Z
|
238 | |
@@ -75,11 +65,6 @@ fn test_datetime_string() {
|
239 | |
|
240 | |
assert_eq!(&date, "2017-06-12T10:58:30Z");
|
|
172 |
@@ -77,7 +67,2 @@
|
241 | 173 |
|
242 | 174 |
- // HJSON
|
243 | 175 |
- let date: String = s.get("hjson_datetime").unwrap();
|
|
245 | 177 |
- assert_eq!(&date, "2017-05-10T02:14:53Z");
|
246 | 178 |
-
|
247 | 179 |
// INI
|
248 | |
let date: String = s.get("ini_datetime").unwrap();
|
249 | |
|
250 | |
@@ -105,11 +90,6 @@ fn test_datetime() {
|
251 | |
|
252 | |
assert_eq!(date, Utc.ymd(2017, 6, 12).and_hms(10, 58, 30));
|
|
180 |
@@ -107,7 +92,2 @@
|
253 | 181 |
|
254 | 182 |
- // HJSON
|
255 | 183 |
- let date: DateTime<Utc> = s.get("hjson_datetime").unwrap();
|
|
257 | 185 |
- assert_eq!(date, Utc.ymd(2017, 5, 10).and_hms(2, 14, 53));
|
258 | 186 |
-
|
259 | 187 |
// INI
|
260 | |
let date: DateTime<Utc> = s.get("ini_datetime").unwrap();
|
261 | |
|
262 | |
diff --git a/tests/file.rs b/tests/file.rs
|
263 | |
index 0680c2a..bef0669 100644
|
264 | 188 |
--- a/tests/file.rs
|
265 | 189 |
+++ b/tests/file.rs
|
266 | |
@@ -49,7 +49,7 @@ fn test_file_auto_not_found() {
|
267 | |
#[test]
|
268 | |
fn test_file_ext() {
|
|
190 |
@@ -51,3 +51,3 @@
|
269 | 191 |
let mut c = Config::default();
|
270 | 192 |
- c.merge(File::with_name("tests/Settings.json")).unwrap();
|
271 | 193 |
+ c.merge(File::with_name("tests/Settings.yaml")).unwrap();
|
272 | 194 |
|
273 | |
assert_eq!(c.get("debug").ok(), Some(true));
|
274 | |
assert_eq!(c.get("production").ok(), Some(false));
|
275 | |
diff --git a/tests/file_hjson.rs b/tests/file_hjson.rs
|
276 | |
deleted file mode 100644
|
277 | |
index 87318eb..0000000
|
278 | 195 |
--- a/tests/file_hjson.rs
|
279 | 196 |
+++ /dev/null
|
280 | 197 |
@@ -1,80 +0,0 @@
|
|
358 | 275 |
- format!("Found a punctuator where a key name was expected (check your syntax or use quotes if the key name includes {{}}[],: or whitespace) at line 4 column 1 in {}", path.display())
|
359 | 276 |
- );
|
360 | 277 |
-}
|
361 | |
diff --git a/tests/file_ini.rs b/tests/file_ini.rs
|
362 | |
index 088eb2c..6dc3522 100644
|
363 | 278 |
--- a/tests/file_ini.rs
|
364 | 279 |
+++ b/tests/file_ini.rs
|
365 | |
@@ -64,7 +64,7 @@ fn test_error_parse() {
|
366 | |
assert_eq!(
|
367 | |
res.unwrap_err().to_string(),
|
|
280 |
@@ -66,3 +66,3 @@
|
368 | 281 |
format!(
|
369 | 282 |
- r#"2:0 Expecting "[Some('='), Some(':')]" but found EOF. in {}"#,
|
370 | 283 |
+ r#"2:0 expecting "[Some('='), Some(':')]" but found EOF. in {}"#,
|
371 | 284 |
path.display()
|
372 | |
)
|
373 | |
);
|