ensure desc sort and cleanup unused imports
This commit is contained in:
parent
86ec0b1d9f
commit
ea278b5b12
1 changed files with 2 additions and 2 deletions
|
@ -16,19 +16,19 @@ use rpc::proto::Timestamp;
|
||||||
use rusqlite::params;
|
use rusqlite::params;
|
||||||
use rusqlite::types::Value;
|
use rusqlite::types::Value;
|
||||||
use std::{
|
use std::{
|
||||||
cmp::Reverse,
|
|
||||||
future::Future,
|
future::Future,
|
||||||
ops::Range,
|
ops::Range,
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
rc::Rc,
|
rc::Rc,
|
||||||
sync::Arc,
|
sync::Arc,
|
||||||
time::{Instant, SystemTime},
|
time::SystemTime,
|
||||||
};
|
};
|
||||||
use util::TryFutureExt;
|
use util::TryFutureExt;
|
||||||
|
|
||||||
pub fn argsort<T: Ord>(data: &[T]) -> Vec<usize> {
|
pub fn argsort<T: Ord>(data: &[T]) -> Vec<usize> {
|
||||||
let mut indices = (0..data.len()).collect::<Vec<_>>();
|
let mut indices = (0..data.len()).collect::<Vec<_>>();
|
||||||
indices.sort_by_key(|&i| &data[i]);
|
indices.sort_by_key(|&i| &data[i]);
|
||||||
|
indices.reverse();
|
||||||
indices
|
indices
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue