Skip to content

Commit 779e7c8

Browse files
committed
Remove unused GitConfig::new function
1 parent 4dc5339 commit 779e7c8

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

src/config/git_config.rs

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,6 @@ pub(crate) struct GitConfig {
4949
}
5050

5151
impl GitConfig {
52-
/// Create a new configuration with default values.
53-
#[must_use]
54-
#[allow(clippy::missing_panics_doc)]
55-
pub(crate) fn new() -> Self {
56-
Self::new_with_config(None).unwrap() // should never error with None config
57-
}
58-
5952
pub(super) fn new_with_config(git_config: Option<&Config>) -> Result<Self, ConfigError> {
6053
let mut comment_char = get_string(git_config, "core.commentChar", "#")?;
6154
if comment_char.as_str().eq("auto") {
@@ -106,7 +99,7 @@ mod tests {
10699
default $default:literal,
107100
$($value: literal => $expected: literal),*
108101
) => {
109-
let config = GitConfig::new();
102+
let config = GitConfig::new_with_config(None).unwrap();
110103
let value = config.$key;
111104
assert_eq!(
112105
value,
@@ -135,11 +128,6 @@ mod tests {
135128
};
136129
}
137130

138-
#[test]
139-
fn new() {
140-
let _config = GitConfig::new();
141-
}
142-
143131
#[test]
144132
fn try_from_git_config() {
145133
with_git_config(&[], |git_config| {
@@ -170,7 +158,7 @@ mod tests {
170158
fn git_editor_default_no_env() {
171159
remove_var("VISUAL");
172160
remove_var("EDITOR");
173-
let config = GitConfig::new();
161+
let config = GitConfig::new_with_config(None).unwrap();
174162
assert_eq!(config.editor, "vi");
175163
}
176164

@@ -179,7 +167,7 @@ mod tests {
179167
fn git_editor_default_visual_env() {
180168
remove_var("EDITOR");
181169
set_var("VISUAL", "visual-editor");
182-
let config = GitConfig::new();
170+
let config = GitConfig::new_with_config(None).unwrap();
183171
assert_eq!(config.editor, "visual-editor");
184172
}
185173

@@ -189,7 +177,7 @@ mod tests {
189177
remove_var("VISUAL");
190178
set_var("EDITOR", "editor");
191179

192-
let config = GitConfig::new();
180+
let config = GitConfig::new_with_config(None).unwrap();
193181
assert_eq!(config.editor, "editor");
194182
}
195183

0 commit comments

Comments
 (0)