File tree Expand file tree Collapse file tree 2 files changed +6
-11
lines changed Expand file tree Collapse file tree 2 files changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -542,8 +542,8 @@ Arguments:
542542 |path| format!( "{} is not a valid UTF8 string" , path. to_string_lossy( ) )
543543 ) ) ;
544544
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 ) ;
547547 eprintln ! ( "help: the available profiles are:" ) ;
548548 for choice in Profile :: all ( ) {
549549 eprintln ! ( "- {}" , choice) ;
Original file line number Diff line number Diff line change @@ -24,21 +24,16 @@ impl Profile {
2424 }
2525}
2626
27- #[ derive( Debug ) ]
28- pub struct ProfileErr {
29- pub name : String ,
30- }
31-
3227impl FromStr for Profile {
33- type Err = ProfileErr ;
28+ type Err = String ;
3429
3530 fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
3631 match s {
3732 "a" | "lib" | "library" => Ok ( Profile :: Library ) ,
3833 "b" | "compiler" => Ok ( Profile :: Compiler ) ,
3934 "c" | "llvm" | "codegen" => Ok ( Profile :: Codegen ) ,
4035 "d" | "maintainer" | "user" => Ok ( Profile :: User ) ,
41- _ => Err ( ProfileErr { name : s . to_string ( ) } ) ,
36+ _ => Err ( format ! ( "unknown profile: '{}'" , s ) ) ,
4237 }
4338 }
4439}
@@ -116,8 +111,8 @@ d) Install Rust from source"
116111 io:: stdin ( ) . read_line ( & mut input) ?;
117112 break match input. trim ( ) . to_lowercase ( ) . parse ( ) {
118113 Ok ( profile) => profile,
119- Err ( ProfileErr { name } ) => {
120- println ! ( "error: unrecognized option '{}' " , name ) ;
114+ Err ( err ) => {
115+ println ! ( "error: {} " , err ) ;
121116 println ! ( "note: press Ctrl+C to exit" ) ;
122117 continue ;
123118 }
You can’t perform that action at this time.
0 commit comments