Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion exercises/anagram/example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::collections::HashSet;

fn sort(word: &str) -> String {
let mut sorted: Vec<char> = word.chars().collect();
sorted.sort();
sorted.sort_unstable();
sorted.into_iter().collect()
}

Expand Down
4 changes: 2 additions & 2 deletions exercises/grade-school/example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ impl School {
pub fn add(&mut self, grade: u32, student: &str) {
let entry = self.grades.entry(grade).or_insert_with(Vec::new);
entry.push(student.to_string());
entry.sort();
entry.sort_unstable();
}

pub fn grades(&self) -> Vec<u32> {
let mut s = self.grades.keys().cloned().collect::<Vec<u32>>();
s.sort();
s.sort_unstable();
s
}

Expand Down
2 changes: 1 addition & 1 deletion exercises/high-scores/example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl<'a> HighScores<'a> {

pub fn personal_top_three(&self) -> Vec<u32> {
let mut sorted = self.scores.to_vec();
sorted.sort();
sorted.sort_unstable();
sorted.reverse();
sorted.truncate(3);
sorted
Expand Down