diff options
author | David Knaack <davidkna@users.noreply.github.com> | 2021-02-11 21:08:17 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-11 21:08:17 +0100 |
commit | 04d1332f9cffda9d0271ad99ac50bec17e918eaf (patch) | |
tree | 425fcd8cf1c5ae168362d533a1686786e9bc3913 | |
parent | e8a02e7d5361dddafbbf87f1398ad95e8da87099 (diff) |
refactor(clippy): fix new lints (#2297)
-rw-r--r-- | src/modules/aws.rs | 42 | ||||
-rw-r--r-- | src/modules/character.rs | 21 | ||||
-rw-r--r-- | src/modules/cmd_duration.rs | 19 | ||||
-rw-r--r-- | src/modules/conda.rs | 13 | ||||
-rw-r--r-- | src/modules/directory.rs | 39 | ||||
-rw-r--r-- | src/modules/dotnet.rs | 32 | ||||
-rw-r--r-- | src/modules/env_var.rs | 25 | ||||
-rw-r--r-- | src/modules/git_status.rs | 1 | ||||
-rw-r--r-- | src/modules/hg_branch.rs | 19 | ||||
-rw-r--r-- | src/modules/hostname.rs | 18 | ||||
-rw-r--r-- | src/modules/jobs.rs | 16 | ||||
-rw-r--r-- | src/modules/line_break.rs | 6 | ||||
-rw-r--r-- | src/modules/nix_shell.rs | 19 | ||||
-rw-r--r-- | src/modules/package.rs | 64 | ||||
-rw-r--r-- | src/modules/ruby.rs | 4 | ||||
-rw-r--r-- | src/modules/shlvl.rs | 31 | ||||
-rw-r--r-- | src/modules/singularity.rs | 7 | ||||
-rw-r--r-- | src/modules/status.rs | 32 | ||||
-rw-r--r-- | src/modules/time.rs | 10 | ||||
-rw-r--r-- | src/modules/username.rs | 28 |
20 files changed, 155 insertions, 291 deletions
diff --git a/src/modules/aws.rs b/src/modules/aws.rs index 0898d9e2f..ed667d695 100644 --- a/src/modules/aws.rs +++ b/src/modules/aws.rs @@ -125,16 +125,15 @@ mod tests { #[test] #[ignore] - fn no_region_set() -> io::Result<()> { + fn no_region_set() { let actual = ModuleRenderer::new("aws").collect(); let expected = None; assert_eq!(expected, actual); - Ok(()) } #[test] - fn region_set() -> io::Result<()> { + fn region_set() { let actual = ModuleRenderer::new("aws") .env("AWS_REGION", "ap-northeast-2") .collect(); @@ -144,11 +143,10 @@ mod tests { )); assert_eq!(expected, actual); - Ok(()) } #[test] - fn region_set_with_alias() -> io::Result<()> { + fn region_set_with_alias() { let actual = ModuleRenderer::new("aws") .env("AWS_REGION", "ap-southeast-2") .config(toml::toml! { @@ -159,11 +157,10 @@ mod tests { let expected = Some(format!("on {} ", Color::Yellow.bold().paint("☁️ (au)"))); assert_eq!(expected, actual); - Ok(()) } #[test] - fn default_region_set() -> io::Result<()> { + fn default_region_set() { let actual = ModuleRenderer::new("aws") .env("AWS_REGION", "ap-northeast-2") .env("AWS_DEFAULT_REGION", "ap-northeast-1") @@ -174,11 +171,10 @@ mod tests { )); assert_eq!(expected, actual); - Ok(()) } #[test] - fn profile_set() -> io::Result<()> { + fn profile_set() { let actual = ModuleRenderer::new("aws") .env("AWS_PROFILE", "astronauts") .collect(); @@ -188,11 +184,10 @@ mod tests { )); assert_eq!(expected, actual); - Ok(()) } #[test] - fn profile_set_from_aws_vault() -> io::Result<()> { + fn profile_set_from_aws_vault() { let actual = ModuleRenderer::new("aws") .env("AWS_VAULT", "astronauts-vault") .env("AWS_PROFILE", "astronauts-profile") @@ -203,11 +198,10 @@ mod tests { )); assert_eq!(expected, actual); - Ok(()) } #[test] - fn profile_and_region_set() -> io::Result<()> { + fn profile_and_region_set() { let actual = ModuleRenderer::new("aws") .env("AWS_PROFILE", "astronauts") .env("AWS_REGION", "ap-northeast-2") @@ -218,7 +212,6 @@ mod tests { )); assert_eq!(expected, actual); - Ok(()) } #[test] @@ -282,7 +275,7 @@ region = us-east-2 } #[test] - fn profile_and_region_set_with_display_all() -> io::Result<()> { + fn profile_and_region_set_with_display_all() { let actual = ModuleRenderer::new("aws") .env("AWS_PROFILE", "astronauts") .env("AWS_REGION", "ap-northeast-1") @@ -293,11 +286,10 @@ region = us-east-2 )); assert_eq!(expected, actual); - Ok(()) } #[test] - fn profile_set_with_display_all() -> io::Result<()> { + fn profile_set_with_display_all() { let actual = ModuleRenderer::new("aws") .env("AWS_PROFILE", "astronauts") .collect(); @@ -307,11 +299,10 @@ region = us-east-2 )); assert_eq!(expected, actual); - Ok(()) } #[test] - fn region_set_with_display_all() -> io::Result<()> { + fn region_set_with_display_all() { let actual = ModuleRenderer::new("aws") .env("AWS_REGION", "ap-northeast-1") .collect(); @@ -321,11 +312,10 @@ region = us-east-2 )); assert_eq!(expected, actual); - Ok(()) } #[test] - fn profile_and_region_set_with_display_region() -> io::Result<()> { + fn profile_and_region_set_with_display_region() { let actual = ModuleRenderer::new("aws") .env("AWS_PROFILE", "astronauts") .env("AWS_DEFAULT_REGION", "ap-northeast-1") @@ -340,11 +330,10 @@ region = us-east-2 )); assert_eq!(expected, actual); - Ok(()) } #[test] - fn profile_and_region_set_with_display_profile() -> io::Result<()> { + fn profile_and_region_set_with_display_profile() { let actual = ModuleRenderer::new("aws") .env("AWS_PROFILE", "astronauts") .env("AWS_REGION", "ap-northeast-1") @@ -359,11 +348,10 @@ region = us-east-2 )); assert_eq!(expected, actual); - Ok(()) } #[test] - fn region_set_with_display_profile() -> io::Result<()> { + fn region_set_with_display_profile() { let actual = ModuleRenderer::new("aws") .env("AWS_REGION", "ap-northeast-1") .config(toml::toml! { @@ -374,12 +362,11 @@ region = us-east-2 let expected = Some(format!("on {} ", Color::Yellow.bold().paint("☁️ "))); assert_eq!(expected, actual); - Ok(()) } #[test] #[ignore] - fn region_not_set_with_display_region() -> io::Result<()> { + fn region_not_set_with_display_region() { let actual = ModuleRenderer::new("aws") .config(toml::toml! { [aws] @@ -389,6 +376,5 @@ region = us-east-2 let expected = None; assert_eq!(expected, actual); - Ok(()) } } diff --git a/src/modules/character.rs b/src/modules/character.rs index dd397ec02..17b373a9a 100644 --- a/src/modules/character.rs +++ b/src/modules/character.rs @@ -74,10 +74,9 @@ mod test { use crate::context::Shell; use crate::test::ModuleRenderer; use ansi_term::Color; - use std::io; #[test] - fn success_status() -> io::Result<()> { + fn success_status() { let expected = Some(format!("{} ", Color::Green.bold().paint("❯"))); // Status code 0 @@ -87,12 +86,10 @@ mod test { // No status code let actual = ModuleRenderer::new("character").collect(); assert_eq!(expected, actual); - - Ok(()) } #[test] - fn failure_status() -> io::Result<()> { + fn failure_status() { let expected = Some(format!("{} ", Color::Red.bold().paint("❯"))); let exit_values = [1, 54321, -5000]; @@ -101,12 +98,10 @@ mod test { let actual = ModuleRenderer::new("character").status(*status).collect(); assert_eq!(expected, actual); } - - Ok(()) } #[test] - fn custom_symbol() -> io::Result<()> { + fn custom_symbol() { let expected_fail = Some(format!("{} ", Color::Red.bold().paint("✖"))); let expected_success = Some(format!("{} ", Color::Green.bold().paint("➜"))); @@ -135,12 +130,10 @@ mod test { .status(0) .collect(); assert_eq!(expected_success, actual); - - Ok(()) } #[test] - fn zsh_keymap() -> io::Result<()> { + fn zsh_keymap() { let expected_vicmd = Some(format!("{} ", Color::Green.bold().paint("❮"))); let expected_specified = Some(format!("{} ", Color::Green.bold().paint("V"))); let expected_other = Some(format!("{} ", Color::Green.bold().paint("❯"))); @@ -169,12 +162,10 @@ mod test { .keymap("visual") .collect(); assert_eq!(expected_other, actual); - - Ok(()) } #[test] - fn fish_keymap() -> io::Result<()> { + fn fish_keymap() { let expected_vicmd = Some(format!("{} ", Color::Green.bold().paint("❮"))); let expected_specified = Some(format!("{} ", Color::Green.bold().paint("V"))); let expected_other = Some(format!("{} ", Color::Green.bold().paint("❯"))); @@ -203,7 +194,5 @@ mod test { .keymap("visual") .collect(); assert_eq!(expected_other, actual); - - Ok(()) } } diff --git a/src/modules/cmd_duration.rs b/src/modules/cmd_duration.rs index 1fe03adae..1d732d299 100644 --- a/src/modules/cmd_duration.rs +++ b/src/modules/cmd_duration.rs @@ -128,7 +128,6 @@ mod tests { use super::*; use crate::test::ModuleRenderer; use ansi_term::Color; - use std::io; #[test] fn test_500ms() { @@ -152,29 +151,27 @@ mod tests { } #[test] - fn config_blank_duration_1s() -> io::Result<()> { + fn config_blank_duration_1s() { let actual = ModuleRenderer::new("cmd_duration") .cmd_duration(1000) .collect(); let expected = None; assert_eq!(expected, actual); - Ok(()) } #[test] - fn config_blank_duration_5s() -> io::Result<()> { + fn config_blank_duration_5s() { let actual = ModuleRenderer::new("cmd_duration") .cmd_duration(5000) .collect(); let expected = Some(format!("took {} ", Color::Yellow.bold().paint("5s"))); assert_eq!(expected, actual); - Ok(()) } #[test] - fn config_5s_duration_3s() -> io::Result<()> { + fn config_5s_duration_3s() { let actual = ModuleRenderer::new("cmd_duration") .config(toml::toml! { [cmd_duration] @@ -185,11 +182,10 @@ mod tests { let expected = None; assert_eq!(expected, actual); - Ok(()) } #[test] - fn config_5s_duration_10s() -> io::Result<()> { + fn config_5s_duration_10s() { let actual = ModuleRenderer::new("cmd_duration") .config(toml::toml! { [cmd_duration] @@ -200,11 +196,10 @@ mod tests { let expected = Some(format!("took {} ", Color::Yellow.bold().paint("10s"))); assert_eq!(expected, actual); - Ok(()) } #[test] - fn config_1s_duration_prefix_underwent() -> io::Result<()> { + fn config_1s_duration_prefix_underwent() { let actual = ModuleRenderer::new("cmd_duration") .config(toml::toml! { [cmd_duration] @@ -215,11 +210,10 @@ mod tests { let expected = None; assert_eq!(expected, actual); - Ok(()) } #[test] - fn config_5s_duration_prefix_underwent() -> io::Result<()> { + fn config_5s_duration_prefix_underwent() { let actual = ModuleRenderer::new("cmd_duration") .config(toml::toml! { [cmd_duration] @@ -230,6 +224,5 @@ mod tests { let expected = Some(format!("underwent {} ", Color::Yellow.bold().paint("5s"))); assert_eq!(expected, actual); - Ok(()) } } diff --git a/src/modules/conda.rs b/src/modules/conda.rs index 36762c4c3..70878b73d 100644 --- a/src/modules/conda.rs +++ b/src/modules/conda.rs @@ -57,20 +57,18 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> { mod tests { use crate::test::ModuleRenderer; use ansi_term::Color; - use std::io; #[test] - fn not_in_env() -> io::Result<()> { + fn not_in_env() { let actual = ModuleRenderer::new("conda").collect(); let expected = None; assert_eq!(expected, actual); - Ok(()) } #[test] - fn ignore_base() -> io::Result<()> { + fn ignore_base() { let actual = ModuleRenderer::new("conda") .env("CONDA_DEFAULT_ENV", "base") .config(toml::toml! { @@ -82,11 +80,10 @@ mod tests { let expected = None; assert_eq!(expected, actual); - Ok(()) } #[test] - fn env_set() -> io::Result<()> { + fn env_set() { let actual = ModuleRenderer::new("conda") .env("CONDA_DEFAULT_ENV", "astronauts") .collect(); @@ -97,11 +94,10 @@ mod tests { )); assert_eq!(expected, actual); - Ok(()) } #[test] - fn truncate() -> io::Result<()> { + fn truncate() { let actual = ModuleRenderer::new("conda") .env("CONDA_DEFAULT_ENV", "/some/really/long/and/really/annoying/path/that/shouldnt/be/displayed/fully/conda/my_env") .collect(); @@ -109,6 +105,5 @@ mod tests { let expected = Some(format!("via {} ", Color::Green.bold().paint("🅒 my_env"))); assert_eq!(expected, actual); - Ok(()) } } diff --git a/src/modules/directory.rs b/src/modules/directory.rs index 7dcd03ecd..721f7827e 100644 --- a/src/modules/directory.rs +++ b/src/modules/directory.rs @@ -515,7 +515,7 @@ mod tests { } #[test] - fn directory_in_root() -> io::Result<()> { + fn directory_in_root() { let actual = ModuleRenderer::new("directory").path("/etc").collect(); let expected = Some(format!( "{}{} ", @@ -524,23 +524,21 @@ mod tests { )); assert_eq!(expected, actual); - Ok(()) } } #[test] - fn home_directory_default_home_symbol() -> io::Result<()> { + fn home_directory_default_home_symbol() { let actual = ModuleRenderer::new("directory") .path(home_dir().unwrap()) .collect(); let expected = Some(format!("{} ", Color::Cyan.bold().paint("~"))); assert_eq!(expected, actual); - Ok(()) } #[test] - fn home_directory_custom_home_symbol() -> io::Result<()> { + fn home_directory_custom_home_symbol() { let actual = ModuleRenderer::new("directory") .path(home_dir().unwrap()) .config(toml::toml! { @@ -551,11 +549,10 @@ mod tests { let expected = Some(format!("{} ", Color::Cyan.bold().paint("🚀"))); assert_eq!(expected, actual); - Ok(()) } #[test] - fn home_directory_custom_home_symbol_subdirectories() -> io::Result<()> { + fn home_directory_custom_home_symbol_subdirectories() { let actual = ModuleRenderer::new("directory") .path(home_dir().unwrap().join("path/subpath")) .config(toml::toml! { @@ -566,11 +563,10 @@ mod tests { let expected = Some(format!("{} ", Color::Cyan.bold().paint("🚀/path/subpath"))); assert_eq!(expected, actual); - Ok(()) } #[test] - fn substituted_truncated_path() -> io::Result<()> { + fn substituted_truncated_path() { let actual = ModuleRenderer::new("directory") .path("/some/long/network/path/workspace/a/b/c/dev") .config(toml::toml! { @@ -587,11 +583,10 @@ mod tests { )); assert_eq!(expected, actual); - Ok(()) } #[test] - fn substitution_order() -> io::Result<()> { + fn substitution_order() { let actual = ModuleRenderer::new("directory") .path("/path/to/sub") .config(toml::toml! { @@ -603,11 +598,10 @@ mod tests { let expected = Some(format!("{} ", Color::Cyan.bold().paint("/correct/order"))); assert_eq!(expected, actual); - Ok(()) } #[test] - fn strange_substitution() -> io::Result<()> { + fn strange_substitution() { let strange_sub = "/\\/;,!"; let actual = ModuleRenderer::new("directory") .path("/foo/bar/regular/path") @@ -627,7 +621,6 @@ mod tests { )); assert_eq!(expected, actual); - Ok(()) } #[test] @@ -690,7 +683,7 @@ mod tests { } #[test] - fn root_directory() -> io::Result<()> { + fn root_directory() { let actual = ModuleRenderer::new("directory").path("/").collect(); #[cfg(not(target_os = "windows"))] let expected = Some(format!( @@ -702,7 +695,6 @@ mod tests { let expected = Some(format!("{} ", Color::Cyan.bold().paint("/"))); assert_eq!(expected, actual); - Ok(()) } #[test] @@ -1234,7 +1226,7 @@ mod tests { } #[test] - fn truncation_symbol_truncated_root() -> io::Result<()> { + fn truncation_symbol_truncated_root() { let actual = ModuleRenderer::new("directory") .config(toml::toml! { [directory] @@ -1248,11 +1240,10 @@ mod tests { Color::Cyan.bold().paint("…/four/element/path") )); assert_eq!(expected, actual); - Ok(()) } #[test] - fn truncation_symbol_not_truncated_root() -> io::Result<()> { + fn truncation_symbol_not_truncated_root() { let actual = ModuleRenderer::new("directory") .config(toml::toml! { [directory] @@ -1266,7 +1257,6 @@ mod tests { Color::Cyan.bold().paint("/a/four/element/path") )); assert_eq!(expected, actual); - Ok(()) } #[test] @@ -1362,7 +1352,7 @@ mod tests { #[test] #[cfg(target_os = "windows")] - fn truncation_symbol_windows_root_not_truncated() -> io::Result<()> { + fn truncation_symbol_windows_root_not_truncated() { let dir = Path::new("C:\\temp"); let actual = ModuleRenderer::new("directory") .config(toml::toml! { @@ -1374,12 +1364,11 @@ mod tests { .collect(); let expected = Some(format!("{} ", Color::Cyan.bold().paint("C:/temp"))); assert_eq!(expected, actual); - Ok(()) } #[test] #[cfg(target_os = "windows")] - fn truncation_symbol_windows_root_truncated() -> io::Result<()> { + fn truncation_symbol_windows_root_truncated() { let dir = Path::new("C:\\temp"); let actual = ModuleRenderer::new("directory") .config(toml::toml! { @@ -1391,12 +1380,11 @@ mod tests { .collect(); let expected = Some(format!("{} ", Color::Cyan.bold().paint("…/temp"))); assert_eq!(expected, actual); - Ok(()) } #[test] #[cfg(target_os = "windows")] - fn truncation_symbol_windows_root_truncated_backslash() -> io::Result<()> { + fn truncation_symbol_windows_root_truncated_backslash() { let dir = Path::new("C:\\temp"); let actual = ModuleRenderer::new("directory") .config(toml::toml! { @@ -1408,7 +1396,6 @@ mod tests { .collect(); let expected = Some(format!("{} ", Color::Cyan.bold().paint("…\\temp"))); assert_eq!(expected, actual); - Ok(()) } #[test] diff --git a/src/modules/dotnet.rs b/src/modules/dotnet.rs index eea1bdbc8..8bb647680 100644 --- a/src/modules/dotnet.rs +++ b/src/modules/dotnet.rs @@ -366,7 +366,7 @@ mod tests { #[test] fn shows_nothing_in_directory_with_zero_relevant_files() -> io::Result<()> { let workspace = create_workspace(false)?; - expect_output(&workspace.path(), None)?; + expect_output(&workspace.path(), None); workspace.close() } @@ -377,7 +377,7 @@ mod tests { expect_output( &workspace.path(), Some(format!("{}", Color::Blue.bold().paint("•NET v3.1.103 "))), - )?; + ); workspace.close() } @@ -388,7 +388,7 @@ mod tests { expect_output( &workspace.path(), Some(format!("{}", Color::Blue.bold().paint("•NET v3.1.103 "))), - )?; + ); workspace.close() } @@ -399,7 +399,7 @@ mod tests { expect_output( &workspace.path(), Some(format!("{}", Color::Blue.bold().paint("•NET v3.1.103 "))), - )?; + ); workspace.close() } @@ -410,7 +410,7 @@ mod tests { expect_output( &workspace.path(), Some(format!("{}", Color::Blue.bold().paint("•NET v3.1.103 "))), - )?; + ); workspace.close() } @@ -425,7 +425,7 @@ mod tests { "{}", Color::Blue.bold().paint("•NET v3.1.103 🎯 netstandard2.0 ") )), - )?; + ); workspace.close() } @@ -436,7 +436,7 @@ mod tests { expect_output( &workspace.path(), Some(format!("{}", Color::Blue.bold().paint("•NET v3.1.103 "))), - )?; + ); workspace.close() } @@ -447,7 +447,7 @@ mod tests { expect_output( &workspace.path(), Some(format!("{}", Color::Blue.bold().paint("•NET v3.1.103 "))), - )?; + ); workspace.close() } @@ -458,7 +458,7 @@ mod tests { expect_output( &workspace.path(), Some(format!("{}", Color::Blue.bold().paint("•NET v3.1.103 "))), - )?; + ); workspace.close() } @@ -470,7 +470,7 @@ mod tests { expect_output( &workspace.path(), Some(format!("{}", Color::Blue.bold().paint("•NET v1.2.3 "))), - )?; + ); workspace.close() } @@ -487,7 +487,7 @@ mod tests { "{}", Color::Blue.bold().paint("•NET v1.2.3 🎯 netstandard2.0 ") )), - )?; + ); workspace.close() } @@ -508,7 +508,7 @@ mod tests { "{}", Color::Blue.bold().paint("•NET v1.2.3 🎯 netstandard2.0 ") )), - )?; + ); workspace.close() } @@ -523,7 +523,7 @@ mod tests { "{}", Color::Blue.bold().paint("•NET v3.1.103 🎯 netstandard2.0 ") )), - )?; + ); workspace.close() } @@ -540,7 +540,7 @@ mod tests { .bold() .paint("•NET v3.1.103 🎯 netstandard2.0;net461 ") )), - )?; + ); workspace.close() } @@ -602,12 +602,10 @@ mod tests { .replace("TFM_VALUE", tfm) } - fn expect_output(dir: &Path, expected: Option<String>) -> io::Result<()> { + fn expect_output(dir: &Path, expected: Option<String>) { let actual = ModuleRenderer::new("dotnet").path(dir).collect(); assert_eq!(actual, expected); - - Ok(()) } #[test] diff --git a/src/modules/env_var.rs b/src/modules/env_var.rs index 47af5074a..819c992da 100644 --- a/src/modules/env_var.rs +++ b/src/modules/env_var.rs @@ -54,12 +54,11 @@ fn get_env_value(context: &Context, name: &str, default: Option<&str>) -> Option mod test { use crate::test::ModuleRenderer; use ansi_term::{Color, Style}; - use std::io; const TEST_VAR_VALUE: &str = "astronauts"; #[test] - fn empty_config() -> io::Result<()> { + fn empty_config() { let actual = ModuleRenderer::new("env_var") .config(toml::toml! { [env_var] @@ -68,11 +67,10 @@ mod test { let expected = None; assert_eq!(expected, actual); - Ok(()) } #[test] - fn defined_variable() -> io::Result<()> { + fn defined_variable() { let actual = ModuleRenderer::new("env_var") .config(toml::toml! { [env_var] @@ -83,11 +81,10 @@ mod test { let expected = Some(format!("with {} ", style().paint(TEST_VAR_VALUE))); assert_eq!(expected, actual); - Ok(()) } #[test] - fn undefined_variable() -> io::Result<()> { + fn undefined_variable() { let actual = ModuleRenderer::new("env_var") .config(toml::toml! { [env_var] @@ -97,11 +94,10 @@ mod test { let expected = None; assert_eq!(expected, actual); - Ok(()) } #[test] - fn default_has_no_effect() -> io::Result<()> { + fn default_has_no_effect() { let actual = ModuleRenderer::new("env_var") .config(toml::toml! { [env_var] @@ -113,11 +109,10 @@ mod test { let expected = Some(format!("with {} ", style().paint(TEST_VAR_VALUE))); assert_eq!(expected, actual); - Ok(()) } #[test] - fn default_takes_effect() -> io::Result<()> { + fn default_takes_effect() { let actual = ModuleRenderer::new("env_var") .config(toml::toml! { [env_var] @@ -128,11 +123,10 @@ mod test { let expected = Some(format!("with {} ", style().paint("N/A"))); assert_eq!(expected, actual); - Ok(()) } #[test] - fn symbol() -> io::Result<()> { + fn symbol() { let actual = ModuleRenderer::new("env_var") .config(toml::toml! { [env_var] @@ -147,11 +141,10 @@ mod test { )); assert_eq!(expected, actual); - Ok(()) } #[test] - fn prefix() -> io::Result<()> { + fn prefix() { let actual = ModuleRenderer::new("env_var") .config(toml::toml! { [env_var] @@ -166,11 +159,10 @@ mod test { )); assert_eq!(expected, actual); - Ok(()) } #[test] - fn suffix() -> io::Result<()> { + fn suffix() { let actual = ModuleRenderer::new("env_var") .config(toml::toml! { [env_var] @@ -185,7 +177,6 @@ mod test { )); assert_eq!(expected, actual); - Ok(()) } fn style() -> Style { diff --git a/src/modules/git_status.rs b/src/modules/git_status.rs index 22ee628b6..ea8f7e764 100644 --- a/src/modules/git_status.rs +++ b/src/modules/git_status.rs @@ -354,6 +354,7 @@ mod tests { std::thread::sleep(std::time::Duration::from_millis(500)); } + #[allow(clippy::unnecessary_wraps)] fn format_output(symbols: &str) -> Option<String> { Some(format!( "{} ", diff --git a/src/modules/hg_branch.rs b/src/modules/hg_branch.rs index 9b6c211a7..6dc54f91e 100644 --- a/src/modules/hg_branch.rs +++ b/src/modules/hg_branch.rs @@ -143,7 +143,7 @@ mod tests { truncation_length = 14 }), &[Expect::Empty], - )?; + ); tempdir.close() } @@ -161,7 +161,7 @@ mod tests { tempdir.path(), None, &[Expect::BranchName(&"default"), Expect::NoTruncation], - )?; + ); tempdir.close() } @@ -169,7 +169,7 @@ mod tests { #[ignore] fn test_hg_get_branch_autodisabled() -> io::Result<()> { let tempdir = tempfile::tempdir()?; - expect_hg_branch_with_config(tempdir.path(), None, &[Expect::Empty])?; + expect_hg_branch_with_config(tempdir.path(), None, &[Expect::Empty]); tempdir.close() } @@ -183,7 +183,7 @@ mod tests { &repo_dir, None, &[Expect::BranchName(&"bookmark-101"), Expect::NoTruncation], - )?; + ); tempdir.close() } @@ -211,7 +211,7 @@ mod tests { disabled = false }), &[Expect::BranchName(&"branch-name-10")], - )?; + ); tempdir.close() } @@ -245,7 +245,7 @@ mod tests { Expect::Symbol(&"B"), Expect::TruncationSymbol(&"%"), ], - )?; + ); tempdir.close() } @@ -278,7 +278,7 @@ mod tests { Expect::Style(Color::Blue.underline()), Expect::TruncationSymbol(&""), ], - )?; + ); tempdir.close() } @@ -286,7 +286,7 @@ mod tests { repo_dir: &Path, config: Option<toml::Value>, expectations: &[Expect], - ) -> io::Result<()> { + ) { let actual = ModuleRenderer::new("hg_branch") |