1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-12-27 03:42:39 +00:00

style: Latest clippy suggestions (#2048)

Have fixed a few new suggestions from the latest version of clippy.
This commit is contained in:
Thomas O'Donnell 2021-01-01 19:45:04 +01:00 committed by GitHub
parent 6de4bb01f4
commit 1ba862b26f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 9 deletions

View File

@ -621,8 +621,10 @@ mod tests {
#[test] #[test]
fn test_variable_holder() { fn test_variable_holder() {
const FORMAT_STR: &str = "($a [($b) $c](none $s)) $d [t]($t)"; const FORMAT_STR: &str = "($a [($b) $c](none $s)) $d [t]($t)";
let expected_variables = let expected_variables = vec!["a", "b", "c", "d"]
BTreeSet::from_iter(vec!["a", "b", "c", "d"].into_iter().map(String::from)); .into_iter()
.map(String::from)
.collect();
let formatter = StringFormatter::new(FORMAT_STR).unwrap().map(empty_mapper); let formatter = StringFormatter::new(FORMAT_STR).unwrap().map(empty_mapper);
let variables = formatter.get_variables(); let variables = formatter.get_variables();
@ -632,7 +634,7 @@ mod tests {
#[test] #[test]
fn test_style_variable_holder() { fn test_style_variable_holder() {
const FORMAT_STR: &str = "($a [($b) $c](none $s)) $d [t]($t)"; 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 formatter = StringFormatter::new(FORMAT_STR).unwrap().map(empty_mapper);
let variables = formatter.get_style_variables(); let variables = formatter.get_style_variables();

View File

@ -132,23 +132,23 @@ mod tests {
#[test] #[test]
fn test_500ms() { fn test_500ms() {
assert_eq!(render_time(500 as u128, true), "500ms") assert_eq!(render_time(500_u128, true), "500ms")
} }
#[test] #[test]
fn test_10s() { fn test_10s() {
assert_eq!(render_time(10_000 as u128, true), "10s") assert_eq!(render_time(10_000_u128, true), "10s")
} }
#[test] #[test]
fn test_90s() { fn test_90s() {
assert_eq!(render_time(90_000 as u128, true), "1m30s") assert_eq!(render_time(90_000_u128, true), "1m30s")
} }
#[test] #[test]
fn test_10110s() { 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] #[test]
fn test_1d() { 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] #[test]

View File

@ -89,7 +89,7 @@ impl<'a> ModuleRenderer<'a> {
// convention was that there would be no module but None. This is nowadays not anymore // 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 // the case (to get durations for all modules). So here we make it so, that an empty
// module returns None in the tests... // module returns None in the tests...
ret.filter(|s| s != "") ret.filter(|s| !s.is_empty())
} }
} }