From 2d95047f7c273f9e97c33b93487c9091ec6abcb7 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 7 Feb 2020 14:55:47 +0100 Subject: Cleanup --- crates/ra_assists/src/lib.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'crates/ra_assists') 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; mod doc_tests; pub mod ast_transform; +use std::cmp::Ordering; + use either::Either; use ra_db::FileRange; use ra_ide_db::RootDatabase; @@ -85,13 +87,12 @@ pub fn resolved_assists(db: &RootDatabase, range: FileRange) -> Vec assist, Assist::Unresolved { .. } => unreachable!(), }) - .collect(); + .collect::>(); sort_assists(&mut a); a } -fn sort_assists(assists: &mut Vec) { - use std::cmp::Ordering; +fn sort_assists(assists: &mut [ResolvedAssist]) { 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(_), None) => Ordering::Less, -- cgit v1.2.3