@@ -49,13 +49,6 @@ pub(crate) struct GitConfig {
49
49
}
50
50
51
51
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
-
59
52
pub ( super ) fn new_with_config ( git_config : Option < & Config > ) -> Result < Self , ConfigError > {
60
53
let mut comment_char = get_string ( git_config, "core.commentChar" , "#" ) ?;
61
54
if comment_char. as_str ( ) . eq ( "auto" ) {
@@ -106,7 +99,7 @@ mod tests {
106
99
default $default: literal,
107
100
$( $value: literal => $expected: literal) ,*
108
101
) => {
109
- let config = GitConfig :: new ( ) ;
102
+ let config = GitConfig :: new_with_config ( None ) . unwrap ( ) ;
110
103
let value = config. $key;
111
104
assert_eq!(
112
105
value,
@@ -135,11 +128,6 @@ mod tests {
135
128
} ;
136
129
}
137
130
138
- #[ test]
139
- fn new ( ) {
140
- let _config = GitConfig :: new ( ) ;
141
- }
142
-
143
131
#[ test]
144
132
fn try_from_git_config ( ) {
145
133
with_git_config ( & [ ] , |git_config| {
@@ -170,7 +158,7 @@ mod tests {
170
158
fn git_editor_default_no_env ( ) {
171
159
remove_var ( "VISUAL" ) ;
172
160
remove_var ( "EDITOR" ) ;
173
- let config = GitConfig :: new ( ) ;
161
+ let config = GitConfig :: new_with_config ( None ) . unwrap ( ) ;
174
162
assert_eq ! ( config. editor, "vi" ) ;
175
163
}
176
164
@@ -179,7 +167,7 @@ mod tests {
179
167
fn git_editor_default_visual_env ( ) {
180
168
remove_var ( "EDITOR" ) ;
181
169
set_var ( "VISUAL" , "visual-editor" ) ;
182
- let config = GitConfig :: new ( ) ;
170
+ let config = GitConfig :: new_with_config ( None ) . unwrap ( ) ;
183
171
assert_eq ! ( config. editor, "visual-editor" ) ;
184
172
}
185
173
@@ -189,7 +177,7 @@ mod tests {
189
177
remove_var ( "VISUAL" ) ;
190
178
set_var ( "EDITOR" , "editor" ) ;
191
179
192
- let config = GitConfig :: new ( ) ;
180
+ let config = GitConfig :: new_with_config ( None ) . unwrap ( ) ;
193
181
assert_eq ! ( config. editor, "editor" ) ;
194
182
}
195
183
0 commit comments