@@ -2,6 +2,7 @@ use std::collections::BTreeMap;
2
2
use std:: collections:: BTreeSet ;
3
3
use std:: collections:: HashSet ;
4
4
use std:: collections:: HashMap ;
5
+ use std:: collections:: VecDeque ;
5
6
use std:: env;
6
7
use std:: path:: Path ;
7
8
use std:: vec:: IntoIter ;
@@ -765,7 +766,7 @@ impl<'a, 'v, 'ab, 'u, 'h, 'ar> App<'a, 'v, 'ab, 'u, 'h, 'ar>{
765
766
. fold ( vec ! [ ] , |acc, v| acc + & v)
766
767
}
767
768
768
- fn get_required_from ( & self , reqs : HashSet < & ' ar str > ) -> Vec < String > {
769
+ fn get_required_from ( & self , reqs : HashSet < & ' ar str > ) -> VecDeque < String > {
769
770
let mut c_flags = HashSet :: new ( ) ;
770
771
let mut c_pos = HashSet :: new ( ) ;
771
772
let mut c_opt = HashSet :: new ( ) ;
@@ -852,27 +853,29 @@ impl<'a, 'v, 'ab, 'u, 'h, 'ar> App<'a, 'v, 'ab, 'u, 'h, 'ar>{
852
853
}
853
854
854
855
855
- let mut ret_val = vec ! [ ] ;
856
+ let mut ret_val = VecDeque :: new ( ) ;
856
857
858
+ let mut pmap = BTreeMap :: new ( ) ;
857
859
for p in & c_pos {
858
860
if let Some ( idx) = self . positionals_name . get ( p) {
859
861
if let Some ( ref p) = self . positionals_idx . get ( & idx) {
860
- ret_val . push ( format ! ( "{}" , p) ) ;
862
+ pmap . insert ( p . index , format ! ( "{}" , p) ) ;
861
863
}
862
864
}
863
865
}
866
+ pmap. into_iter ( ) . map ( |( _, s) | ret_val. push_back ( s) ) . collect :: < Vec < _ > > ( ) ;
864
867
for f in & c_flags {
865
- ret_val. push ( format ! ( "{}" , self . flags. get( * f) . unwrap( ) ) ) ;
868
+ ret_val. push_back ( format ! ( "{}" , self . flags. get( * f) . unwrap( ) ) ) ;
866
869
}
867
870
for o in & c_opt {
868
- ret_val. push ( format ! ( "{}" , self . opts. get( * o) . unwrap( ) ) ) ;
871
+ ret_val. push_back ( format ! ( "{}" , self . opts. get( * o) . unwrap( ) ) ) ;
869
872
}
870
873
for g in grps {
871
874
let g_string = self . get_group_members ( g) . iter ( )
872
875
. fold ( String :: new ( ) , |acc, s| {
873
876
acc + & format ! ( " {} |" , s) [ ..]
874
877
} ) ;
875
- ret_val. push ( format ! ( "[{}]" , & g_string[ ..g_string. len( ) -1 ] ) ) ;
878
+ ret_val. push_back ( format ! ( "[{}]" , & g_string[ ..g_string. len( ) -1 ] ) ) ;
876
879
}
877
880
878
881
ret_val
0 commit comments