File tree Expand file tree Collapse file tree 3 files changed +4
-4
lines changed Expand file tree Collapse file tree 3 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ use std::collections::HashSet;
2
2
3
3
fn sort ( word : & str ) -> String {
4
4
let mut sorted: Vec < char > = word. chars ( ) . collect ( ) ;
5
- sorted. sort ( ) ;
5
+ sorted. sort_unstable ( ) ;
6
6
sorted. into_iter ( ) . collect ( )
7
7
}
8
8
Original file line number Diff line number Diff line change @@ -14,12 +14,12 @@ impl School {
14
14
pub fn add ( & mut self , grade : u32 , student : & str ) {
15
15
let entry = self . grades . entry ( grade) . or_insert_with ( Vec :: new) ;
16
16
entry. push ( student. to_string ( ) ) ;
17
- entry. sort ( ) ;
17
+ entry. sort_unstable ( ) ;
18
18
}
19
19
20
20
pub fn grades ( & self ) -> Vec < u32 > {
21
21
let mut s = self . grades . keys ( ) . cloned ( ) . collect :: < Vec < u32 > > ( ) ;
22
- s. sort ( ) ;
22
+ s. sort_unstable ( ) ;
23
23
s
24
24
}
25
25
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ impl<'a> HighScores<'a> {
22
22
23
23
pub fn personal_top_three ( & self ) -> Vec < u32 > {
24
24
let mut sorted = self . scores . to_vec ( ) ;
25
- sorted. sort ( ) ;
25
+ sorted. sort_unstable ( ) ;
26
26
sorted. reverse ( ) ;
27
27
sorted. truncate ( 3 ) ;
28
28
sorted
You can’t perform that action at this time.
0 commit comments