@@ -986,19 +986,26 @@ pub fn get_cmd_lint_options(
986
986
matches : & getopts:: Matches ,
987
987
error_format : ErrorOutputType ,
988
988
) -> ( Vec < ( String , lint:: Level ) > , bool , Option < lint:: Level > ) {
989
- let mut lint_opts = vec ! [ ] ;
989
+ let mut lint_opts_with_position = vec ! [ ] ;
990
990
let mut describe_lints = false ;
991
991
992
992
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 ( ) ) {
994
994
if lint_name == "help" {
995
995
describe_lints = true ;
996
996
} else {
997
- lint_opts . push ( ( lint_name. replace ( "-" , "_" ) , level) ) ;
997
+ lint_opts_with_position . push ( ( arg_pos , lint_name. replace ( "-" , "_" ) , level) ) ;
998
998
}
999
999
}
1000
1000
}
1001
1001
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
+
1002
1009
let lint_cap = matches. opt_str ( "cap-lints" ) . map ( |cap| {
1003
1010
lint:: Level :: from_str ( & cap)
1004
1011
. unwrap_or_else ( || early_error ( error_format, & format ! ( "unknown lint level: `{}`" , cap) ) )
0 commit comments