summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas O'Donnell <andytom@users.noreply.github.com>2021-01-01 19:45:04 +0100
committerGitHub <noreply@github.com>2021-01-01 12:45:04 -0600
commit1ba862b26feadc6b0c65b233bd2c484c6fa48475 (patch)
tree179628c5d842c53709a637de9cde91f69aaf8e3f
parent6de4bb01f4d42a526f3c6294f249fd6c024d5ef8 (diff)
style: Latest clippy suggestions (#2048)
Have fixed a few new suggestions from the latest version of clippy.
-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())
}
}