mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 22:54:58 +00:00
Cleanup
This commit is contained in:
parent
b831b17b3d
commit
2d95047f7c
1 changed files with 4 additions and 3 deletions
|
@ -11,6 +11,8 @@ mod marks;
|
||||||
mod doc_tests;
|
mod doc_tests;
|
||||||
pub mod ast_transform;
|
pub mod ast_transform;
|
||||||
|
|
||||||
|
use std::cmp::Ordering;
|
||||||
|
|
||||||
use either::Either;
|
use either::Either;
|
||||||
use ra_db::FileRange;
|
use ra_db::FileRange;
|
||||||
use ra_ide_db::RootDatabase;
|
use ra_ide_db::RootDatabase;
|
||||||
|
@ -85,13 +87,12 @@ pub fn resolved_assists(db: &RootDatabase, range: FileRange) -> Vec<ResolvedAssi
|
||||||
Assist::Resolved { assist } => assist,
|
Assist::Resolved { assist } => assist,
|
||||||
Assist::Unresolved { .. } => unreachable!(),
|
Assist::Unresolved { .. } => unreachable!(),
|
||||||
})
|
})
|
||||||
.collect();
|
.collect::<Vec<_>>();
|
||||||
sort_assists(&mut a);
|
sort_assists(&mut a);
|
||||||
a
|
a
|
||||||
}
|
}
|
||||||
|
|
||||||
fn sort_assists(assists: &mut Vec<ResolvedAssist>) {
|
fn sort_assists(assists: &mut [ResolvedAssist]) {
|
||||||
use std::cmp::Ordering;
|
|
||||||
assists.sort_by(|a, b| match (a.get_first_action().target, b.get_first_action().target) {
|
assists.sort_by(|a, b| match (a.get_first_action().target, b.get_first_action().target) {
|
||||||
(Some(a), Some(b)) => a.len().cmp(&b.len()),
|
(Some(a), Some(b)) => a.len().cmp(&b.len()),
|
||||||
(Some(_), None) => Ordering::Less,
|
(Some(_), None) => Ordering::Less,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue