Skip to content

Commit

Permalink
remove custom Ord
Browse files Browse the repository at this point in the history
  • Loading branch information
zealchen committed Jan 23, 2025
1 parent 1e324ef commit 218fadd
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions server/src/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,23 +294,6 @@ async fn list_inner(
}
}

fn top_n_sort<T: std::cmp::Ord + std::cmp::Eq + Default>(vec: &mut Vec<T>, top: usize) {
for i in 1..vec.len() {
let high = top.min(i);
if vec[high - 1] > vec[i] {
continue;
}
let key = vec.remove(i);
let mut pos = vec[..high]
.binary_search_by(|e| key.cmp(e))
.unwrap_or_else(|pos| pos);
if pos == high {
pos -= 1;
}
vec.insert(pos, key);
}
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down

0 comments on commit 218fadd

Please sign in to comment.