@@ -674,35 +674,6 @@ fn usage(argv0: &str) {
674674/// A result type used by several functions under `main()`.
675675type MainResult = Result < ( ) , ErrorGuaranteed > ;
676676
677- fn main_args ( at_args : & [ String ] ) -> MainResult {
678- let args = rustc_driver:: args:: arg_expand_all ( at_args) ;
679-
680- let mut options = getopts:: Options :: new ( ) ;
681- for option in opts ( ) {
682- ( option. apply ) ( & mut options) ;
683- }
684- let matches = match options. parse ( & args[ 1 ..] ) {
685- Ok ( m) => m,
686- Err ( err) => {
687- early_error ( ErrorOutputType :: default ( ) , & err. to_string ( ) ) ;
688- }
689- } ;
690-
691- // Note that we discard any distinction between different non-zero exit
692- // codes from `from_matches` here.
693- let options = match config:: Options :: from_matches ( & matches, args) {
694- Ok ( opts) => opts,
695- Err ( code) => {
696- return if code == 0 {
697- Ok ( ( ) )
698- } else {
699- Err ( ErrorGuaranteed :: unchecked_claim_error_was_emitted ( ) )
700- } ;
701- }
702- } ;
703- main_options ( options)
704- }
705-
706677fn wrap_return ( diag : & rustc_errors:: Handler , res : Result < ( ) , String > ) -> MainResult {
707678 match res {
708679 Ok ( ( ) ) => Ok ( ( ) ) ,
@@ -733,7 +704,33 @@ fn run_renderer<'tcx, T: formats::FormatRenderer<'tcx>>(
733704 }
734705}
735706
736- fn main_options ( options : config:: Options ) -> MainResult {
707+ fn main_args ( at_args : & [ String ] ) -> MainResult {
708+ let args = rustc_driver:: args:: arg_expand_all ( at_args) ;
709+
710+ let mut options = getopts:: Options :: new ( ) ;
711+ for option in opts ( ) {
712+ ( option. apply ) ( & mut options) ;
713+ }
714+ let matches = match options. parse ( & args[ 1 ..] ) {
715+ Ok ( m) => m,
716+ Err ( err) => {
717+ early_error ( ErrorOutputType :: default ( ) , & err. to_string ( ) ) ;
718+ }
719+ } ;
720+
721+ // Note that we discard any distinction between different non-zero exit
722+ // codes from `from_matches` here.
723+ let options = match config:: Options :: from_matches ( & matches, args) {
724+ Ok ( opts) => opts,
725+ Err ( code) => {
726+ return if code == 0 {
727+ Ok ( ( ) )
728+ } else {
729+ Err ( ErrorGuaranteed :: unchecked_claim_error_was_emitted ( ) )
730+ } ;
731+ }
732+ } ;
733+
737734 let diag = core:: new_handler (
738735 options. error_format ,
739736 None ,
0 commit comments