@@ -986,19 +986,26 @@ pub fn get_cmd_lint_options(
986986 matches : & getopts:: Matches ,
987987 error_format : ErrorOutputType ,
988988) -> ( Vec < ( String , lint:: Level ) > , bool , Option < lint:: Level > ) {
989- let mut lint_opts = vec ! [ ] ;
989+ let mut lint_opts_with_position = vec ! [ ] ;
990990 let mut describe_lints = false ;
991991
992992 for & level in & [ lint:: Allow , lint:: Warn , lint:: Deny , lint:: Forbid ] {
993- for lint_name in matches. opt_strs ( level. as_str ( ) ) {
993+ for ( arg_pos , lint_name) in matches. opt_strs_pos ( level. as_str ( ) ) {
994994 if lint_name == "help" {
995995 describe_lints = true ;
996996 } else {
997- lint_opts . push ( ( lint_name. replace ( "-" , "_" ) , level) ) ;
997+ lint_opts_with_position . push ( ( arg_pos , lint_name. replace ( "-" , "_" ) , level) ) ;
998998 }
999999 }
10001000 }
10011001
1002+ lint_opts_with_position. sort_by_key ( |x| x. 0 ) ;
1003+ let lint_opts = lint_opts_with_position
1004+ . iter ( )
1005+ . cloned ( )
1006+ . map ( |( _, lint_name, level) | ( lint_name, level) )
1007+ . collect ( ) ;
1008+
10021009 let lint_cap = matches. opt_str ( "cap-lints" ) . map ( |cap| {
10031010 lint:: Level :: from_str ( & cap)
10041011 . unwrap_or_else ( || early_error ( error_format, & format ! ( "unknown lint level: `{}`" , cap) ) )
0 commit comments