File tree 2 files changed +6
-11
lines changed
2 files changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -542,8 +542,8 @@ Arguments:
542
542
|path| format!( "{} is not a valid UTF8 string" , path. to_string_lossy( ) )
543
543
) ) ;
544
544
545
- profile_string. parse ( ) . unwrap_or_else ( |_ | {
546
- eprintln ! ( "error: unknown profile {}" , profile_string ) ;
545
+ profile_string. parse ( ) . unwrap_or_else ( |err | {
546
+ eprintln ! ( "error: {}" , err ) ;
547
547
eprintln ! ( "help: the available profiles are:" ) ;
548
548
for choice in Profile :: all ( ) {
549
549
eprintln ! ( "- {}" , choice) ;
Original file line number Diff line number Diff line change @@ -24,21 +24,16 @@ impl Profile {
24
24
}
25
25
}
26
26
27
- #[ derive( Debug ) ]
28
- pub struct ProfileErr {
29
- pub name : String ,
30
- }
31
-
32
27
impl FromStr for Profile {
33
- type Err = ProfileErr ;
28
+ type Err = String ;
34
29
35
30
fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
36
31
match s {
37
32
"a" | "lib" | "library" => Ok ( Profile :: Library ) ,
38
33
"b" | "compiler" => Ok ( Profile :: Compiler ) ,
39
34
"c" | "llvm" | "codegen" => Ok ( Profile :: Codegen ) ,
40
35
"d" | "maintainer" | "user" => Ok ( Profile :: User ) ,
41
- _ => Err ( ProfileErr { name : s . to_string ( ) } ) ,
36
+ _ => Err ( format ! ( "unknown profile: '{}'" , s ) ) ,
42
37
}
43
38
}
44
39
}
@@ -116,8 +111,8 @@ d) Install Rust from source"
116
111
io:: stdin ( ) . read_line ( & mut input) ?;
117
112
break match input. trim ( ) . to_lowercase ( ) . parse ( ) {
118
113
Ok ( profile) => profile,
119
- Err ( ProfileErr { name } ) => {
120
- println ! ( "error: unrecognized option '{}' " , name ) ;
114
+ Err ( err ) => {
115
+ println ! ( "error: {} " , err ) ;
121
116
println ! ( "note: press Ctrl+C to exit" ) ;
122
117
continue ;
123
118
}
You can’t perform that action at this time.
0 commit comments