aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-02-07 13:55:47 +0000
committerAleksey Kladov <[email protected]>2020-02-07 13:55:47 +0000
commit2d95047f7c273f9e97c33b93487c9091ec6abcb7 (patch)
tree789a69f0bdee1eefbfbce498863fff5e78911009
parentb831b17b3dbc475420924834b250f07bccd673d0 (diff)
Cleanup
-rw-r--r--crates/ra_assists/src/lib.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/crates/ra_assists/src/lib.rs b/crates/ra_assists/src/lib.rs
index fcdfe6c14..b71df7e5d 100644
--- a/crates/ra_assists/src/lib.rs
+++ b/crates/ra_assists/src/lib.rs
@@ -11,6 +11,8 @@ mod marks;
11mod doc_tests; 11mod doc_tests;
12pub mod ast_transform; 12pub mod ast_transform;
13 13
14use std::cmp::Ordering;
15
14use either::Either; 16use either::Either;
15use ra_db::FileRange; 17use ra_db::FileRange;
16use ra_ide_db::RootDatabase; 18use ra_ide_db::RootDatabase;
@@ -85,13 +87,12 @@ pub fn resolved_assists(db: &RootDatabase, range: FileRange) -> Vec<ResolvedAssi
85 Assist::Resolved { assist } => assist, 87 Assist::Resolved { assist } => assist,
86 Assist::Unresolved { .. } => unreachable!(), 88 Assist::Unresolved { .. } => unreachable!(),
87 }) 89 })
88 .collect(); 90 .collect::<Vec<_>>();
89 sort_assists(&mut a); 91 sort_assists(&mut a);
90 a 92 a
91} 93}
92 94
93fn sort_assists(assists: &mut Vec<ResolvedAssist>) { 95fn sort_assists(assists: &mut [ResolvedAssist]) {
94 use std::cmp::Ordering;
95 assists.sort_by(|a, b| match (a.get_first_action().target, b.get_first_action().target) { 96 assists.sort_by(|a, b| match (a.get_first_action().target, b.get_first_action().target) {
96 (Some(a), Some(b)) => a.len().cmp(&b.len()), 97 (Some(a), Some(b)) => a.len().cmp(&b.len()),
97 (Some(_), None) => Ordering::Less, 98 (Some(_), None) => Ordering::Less,