@@ -25,7 +25,7 @@ use crate::toolchain::{DistributableToolchain, Toolchain, UpdateStatus};
25
25
use crate :: utils:: utils;
26
26
27
27
#[ derive( Debug , ThisError ) ]
28
- enum ConfigError {
28
+ enum OverrideFileConfigError {
29
29
#[ error( "empty toolchain override file detected. Please remove it, or else specify the desired toolchain properties in the file" ) ]
30
30
Empty ,
31
31
#[ error( "missing toolchain properties in toolchain override file" ) ]
@@ -677,22 +677,22 @@ impl Cfg {
677
677
let contents = contents. as_ref ( ) ;
678
678
679
679
match ( contents. lines ( ) . count ( ) , parse_mode) {
680
- ( 0 , _) => Err ( anyhow ! ( ConfigError :: Empty ) ) ,
680
+ ( 0 , _) => Err ( anyhow ! ( OverrideFileConfigError :: Empty ) ) ,
681
681
( 1 , ParseMode :: Both ) => {
682
682
let channel = contents. trim ( ) ;
683
683
684
684
if channel. is_empty ( ) {
685
- Err ( anyhow ! ( ConfigError :: Empty ) )
685
+ Err ( anyhow ! ( OverrideFileConfigError :: Empty ) )
686
686
} else {
687
687
Ok ( channel. into ( ) )
688
688
}
689
689
}
690
690
_ => {
691
- let override_file =
692
- toml :: from_str :: < OverrideFile > ( contents ) . context ( ConfigError :: Parsing ) ?;
691
+ let override_file = toml :: from_str :: < OverrideFile > ( contents )
692
+ . context ( OverrideFileConfigError :: Parsing ) ?;
693
693
694
694
if override_file. is_empty ( ) {
695
- Err ( anyhow ! ( ConfigError :: Invalid ) )
695
+ Err ( anyhow ! ( OverrideFileConfigError :: Invalid ) )
696
696
} else {
697
697
Ok ( override_file)
698
698
}
@@ -1162,8 +1162,8 @@ components = [ "rustfmt" ]
1162
1162
1163
1163
let result = Cfg :: parse_override_file ( contents, ParseMode :: Both ) ;
1164
1164
assert ! ( matches!(
1165
- result. unwrap_err( ) . downcast:: <ConfigError >( ) ,
1166
- Ok ( ConfigError :: Invalid )
1165
+ result. unwrap_err( ) . downcast:: <OverrideFileConfigError >( ) ,
1166
+ Ok ( OverrideFileConfigError :: Invalid )
1167
1167
) ) ;
1168
1168
}
1169
1169
@@ -1173,8 +1173,8 @@ components = [ "rustfmt" ]
1173
1173
1174
1174
let result = Cfg :: parse_override_file ( contents, ParseMode :: Both ) ;
1175
1175
assert ! ( matches!(
1176
- result. unwrap_err( ) . downcast:: <ConfigError >( ) ,
1177
- Ok ( ConfigError :: Empty )
1176
+ result. unwrap_err( ) . downcast:: <OverrideFileConfigError >( ) ,
1177
+ Ok ( OverrideFileConfigError :: Empty )
1178
1178
) ) ;
1179
1179
}
1180
1180
@@ -1184,8 +1184,8 @@ components = [ "rustfmt" ]
1184
1184
1185
1185
let result = Cfg :: parse_override_file ( contents, ParseMode :: Both ) ;
1186
1186
assert ! ( matches!(
1187
- result. unwrap_err( ) . downcast:: <ConfigError >( ) ,
1188
- Ok ( ConfigError :: Empty )
1187
+ result. unwrap_err( ) . downcast:: <OverrideFileConfigError >( ) ,
1188
+ Ok ( OverrideFileConfigError :: Empty )
1189
1189
) ) ;
1190
1190
}
1191
1191
@@ -1197,8 +1197,8 @@ channel = nightly
1197
1197
1198
1198
let result = Cfg :: parse_override_file ( contents, ParseMode :: Both ) ;
1199
1199
assert ! ( matches!(
1200
- result. unwrap_err( ) . downcast:: <ConfigError >( ) ,
1201
- Ok ( ConfigError :: Parsing )
1200
+ result. unwrap_err( ) . downcast:: <OverrideFileConfigError >( ) ,
1201
+ Ok ( OverrideFileConfigError :: Parsing )
1202
1202
) ) ;
1203
1203
}
1204
1204
}
0 commit comments