diff options
author | Tim Oram <dev@mitmaro.ca> | 2024-02-15 11:26:36 -0330 |
---|---|---|
committer | Tim Oram <dev@mitmaro.ca> | 2024-02-15 20:27:06 -0330 |
commit | 779e7c807cdfbff9f0f8f45f0697060d0b341500 (patch) | |
tree | 72947f8d53a7736fdf30b435b73138228445daa8 /src | |
parent | 4dc5339620a21c7a06e4f7b89c01bbab37eca91b (diff) |
Remove unused GitConfig::new function
Diffstat (limited to 'src')
-rw-r--r-- | src/config/git_config.rs | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/src/config/git_config.rs b/src/config/git_config.rs index 7a96788..60b4c45 100644 --- a/src/config/git_config.rs +++ b/src/config/git_config.rs @@ -49,13 +49,6 @@ pub(crate) struct GitConfig { } impl GitConfig { - /// Create a new configuration with default values. - #[must_use] - #[allow(clippy::missing_panics_doc)] - pub(crate) fn new() -> Self { - Self::new_with_config(None).unwrap() // should never error with None config - } - pub(super) fn new_with_config(git_config: Option<&Config>) -> Result<Self, ConfigError> { let mut comment_char = get_string(git_config, "core.commentChar", "#")?; if comment_char.as_str().eq("auto") { @@ -106,7 +99,7 @@ mod tests { default $default:literal, $($value: literal => $expected: literal),* ) => { - let config = GitConfig::new(); + let config = GitConfig::new_with_config(None).unwrap(); let value = config.$key; assert_eq!( value, @@ -136,11 +129,6 @@ mod tests { } #[test] - fn new() { - let _config = GitConfig::new(); - } - - #[test] fn try_from_git_config() { with_git_config(&[], |git_config| { assert_ok!(GitConfig::try_from(&git_config)); @@ -170,7 +158,7 @@ mod tests { fn git_editor_default_no_env() { remove_var("VISUAL"); remove_var("EDITOR"); - let config = GitConfig::new(); + let config = GitConfig::new_with_config(None).unwrap(); assert_eq!(config.editor, "vi"); } @@ -179,7 +167,7 @@ mod tests { fn git_editor_default_visual_env() { remove_var("EDITOR"); set_var("VISUAL", "visual-editor"); - let config = GitConfig::new(); + let config = GitConfig::new_with_config(None).unwrap(); assert_eq!(config.editor, "visual-editor"); } @@ -189,7 +177,7 @@ mod tests { remove_var("VISUAL"); set_var("EDITOR", "editor"); - let config = GitConfig::new(); + let config = GitConfig::new_with_config(None).unwrap(); assert_eq!(config.editor, "editor"); } |