summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/formatter/string_formatter.rs8
-rw-r--r--src/modules/cmd_duration.rs10
-rw-r--r--src/test/mod.rs2
3 files changed, 11 insertions, 9 deletions
diff --git a/src/formatter/string_formatter.rs b/src/formatter/string_formatter.rs
index 890795bc3..c3583fe3f 100644
--- a/src/formatter/string_formatter.rs
+++ b/src/formatter/string_formatter.rs
@@ -621,8 +621,10 @@ mod tests {
#[test]
fn test_variable_holder() {
const FORMAT_STR: &str = "($a [($b) $c](none $s)) $d [t]($t)";
- let expected_variables =
- BTreeSet::from_iter(vec!["a", "b", "c", "d"].into_iter().map(String::from));
+ let expected_variables = vec!["a", "b", "c", "d"]
+ .into_iter()
+ .map(String::from)
+ .collect();
let formatter = StringFormatter::new(FORMAT_STR).unwrap().map(empty_mapper);
let variables = formatter.get_variables();
@@ -632,7 +634,7 @@ mod tests {
#[test]
fn test_style_variable_holder() {
const FORMAT_STR: &str = "($a [($b) $c](none $s)) $d [t]($t)";
- let expected_variables = BTreeSet::from_iter(vec!["s", "t"].into_iter().map(String::from));
+ let expected_variables = vec!["s", "t"].into_iter().map(String::from).collect();
let formatter = StringFormatter::new(FORMAT_STR).unwrap().map(empty_mapper);
let variables = formatter.get_style_variables();
diff --git a/src/modules/cmd_duration.rs b/src/modules/cmd_duration.rs
index 037310842..1fe03adae 100644
--- a/src/modules/cmd_duration.rs
+++ b/src/modules/cmd_duration.rs
@@ -132,23 +132,23 @@ mod tests {
#[test]
fn test_500ms() {
- assert_eq!(render_time(500 as u128, true), "500ms")
+ assert_eq!(render_time(500_u128, true), "500ms")
}
#[test]
fn test_10s() {
- assert_eq!(render_time(10_000 as u128, true), "10s")
+ assert_eq!(render_time(10_000_u128, true), "10s")
}
#[test]
fn test_90s() {
- assert_eq!(render_time(90_000 as u128, true), "1m30s")
+ assert_eq!(render_time(90_000_u128, true), "1m30s")
}
#[test]
fn test_10110s() {
- assert_eq!(render_time(10_110_000 as u128, true), "2h48m30s")
+ assert_eq!(render_time(10_110_000_u128, true), "2h48m30s")
}
#[test]
fn test_1d() {
- assert_eq!(render_time(86_400_000 as u128, true), "1d")
+ assert_eq!(render_time(86_400_000_u128, true), "1d")
}
#[test]
diff --git a/src/test/mod.rs b/src/test/mod.rs
index ae19f6f5a..f02192ec0 100644
--- a/src/test/mod.rs
+++ b/src/test/mod.rs
@@ -89,7 +89,7 @@ impl<'a> ModuleRenderer<'a> {
// convention was that there would be no module but None. This is nowadays not anymore
// the case (to get durations for all modules). So here we make it so, that an empty
// module returns None in the tests...
- ret.filter(|s| s != "")
+ ret.filter(|s| !s.is_empty())
}
}