Skip to content

Commit 37bff8b

Browse files
committed
fix test cases warning
1 parent 8268229 commit 37bff8b

File tree

1 file changed

+8
-17
lines changed

1 file changed

+8
-17
lines changed

tests/testsuite/file_jsonc.rs

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ fn test_file() {
4949
let s: Settings = c.try_deserialize().unwrap();
5050

5151
assert!(s.debug.approx_eq_ulps(&1.0, 2));
52-
assert_eq!(s.production, Some("false".to_string()));
52+
assert_eq!(s.production, Some("false".to_owned()));
5353
assert_eq!(s.place.name, "Torre di Pisa");
5454
assert!(s.place.longitude.approx_eq_ulps(&43.722_498_5, 2));
5555
assert!(s.place.latitude.approx_eq_ulps(&10.397_052_2, 2));
@@ -58,23 +58,23 @@ fn test_file() {
5858
assert_eq!(s.place.rating, Some(4.5));
5959
assert_eq!(s.place.telephone, None);
6060
assert_eq!(s.elements.len(), 10);
61-
assert_eq!(s.elements[3], "4".to_string());
61+
assert_eq!(s.elements[3], "4".to_owned());
6262
if cfg!(feature = "preserve_order") {
6363
assert_eq!(
6464
s.place
6565
.creator
6666
.into_iter()
6767
.collect::<Vec<(String, Value)>>(),
6868
vec![
69-
("name".to_string(), "John Smith".into()),
69+
("name".to_owned(), "John Smith".into()),
7070
("username".into(), "jsmith".into()),
7171
("email".into(), "jsmith@localhost".into()),
7272
]
7373
);
7474
} else {
7575
assert_eq!(
7676
s.place.creator["name"].clone().into_string().unwrap(),
77-
"John Smith".to_string()
77+
"John Smith".to_owned()
7878
);
7979
}
8080
}
@@ -118,17 +118,9 @@ fn test_override_uppercase_value_for_struct() {
118118
.unwrap();
119119

120120
let settings = cfg.try_deserialize::<OverrideSettings>();
121-
122-
match settings {
123-
Ok(v) => {
124-
// this assertion will ensure that the map has only lowercase keys
125-
assert_eq!(v.FOO, "FOO should be overridden");
126-
assert_eq!(v.foo, "I HAVE BEEN OVERRIDDEN_WITH_UPPER_CASE".to_string());
127-
}
128-
Err(e) => {
129-
panic!("{}", e);
130-
}
131-
}
121+
// this assertion will ensure that the map has only lowercase keys
122+
assert_eq!(v.FOO, "FOO should be overridden");
123+
assert_eq!(v.foo, "I HAVE BEEN OVERRIDDEN_WITH_UPPER_CASE".to_owned());
132124
}
133125

134126
#[test]
@@ -142,8 +134,7 @@ fn test_override_lowercase_value_for_struct() {
142134
.unwrap();
143135

144136
let values: OverrideSettings = cfg.try_deserialize().unwrap();
145-
assert_eq!(values.foo, "I have been overridden_with_lower_case".to_string()
146-
);
137+
assert_eq!(values.foo, "I have been overridden_with_lower_case".to_owned());
147138
}
148139

149140
#[derive(Debug, Deserialize, PartialEq)]

0 commit comments

Comments
 (0)