Repository: rust-analyzer/rust-analyzer
Pull request #3038 (2020-02-06 17:49:53)

Minor rename


Patch:
diff --git a/crates/ra_assists/src/lib.rs b/crates/ra_assists/src/lib.rs
index 1343043ddf..3f3df3f969 100644
--- a/crates/ra_assists/src/lib.rs
+++ b/crates/ra_assists/src/lib.rs
@@ -59,7 +59,7 @@ impl ResolvedAssist {
 ///
 /// Assists are returned in the "unresolved" state, that is only labels are
 /// returned, without actual edits.
-pub fn applicable_assists(db: &RootDatabase, range: FileRange) -> Vec<AssistLabel> {
+pub fn unresolved_assists(db: &RootDatabase, range: FileRange) -> Vec<AssistLabel> {
     AssistCtx::with_ctx(db, range, false, |ctx| {
         assists::all()
             .iter()
@@ -76,7 +76,7 @@ pub fn applicable_assists(db: &RootDatabase, range: FileRange) -> Vec<AssistLabe
 ///
 /// Assists are returned in the "resolved" state, that is with edit fully
 /// computed.
-pub fn assists(db: &RootDatabase, range: FileRange) -> Vec<ResolvedAssist> {
+pub fn resolved_assists(db: &RootDatabase, range: FileRange) -> Vec<ResolvedAssist> {
     AssistCtx::with_ctx(db, range, true, |ctx| {
         let mut a = assists::all()
             .iter()
@@ -301,7 +301,7 @@ mod tests {
     use ra_syntax::TextRange;
     use test_utils::{extract_offset, extract_range};
 
-    use crate::helpers;
+    use crate::{helpers, resolved_assists};
 
     #[test]
     fn assist_order_field_struct() {
@@ -310,7 +310,7 @@ mod tests {
         let (db, file_id) = helpers::with_single_file(&before);
         let frange =
             FileRange { file_id, range: TextRange::offset_len(before_cursor_pos, 0.into()) };
-        let assists = super::assists(&db, frange);
+        let assists = resolved_assists(&db, frange);
         let mut assists = assists.iter();
 
         assert_eq!(
@@ -333,7 +333,7 @@ mod tests {
         let (range, before) = extract_range(before);
         let (db, file_id) = helpers::with_single_file(&before);
         let frange = FileRange { file_id, range };
-        let assists = super::assists(&db, frange);
+        let assists = resolved_assists(&db, frange);
         let mut assists = assists.iter();
 
         assert_eq!(assists.next().expect("expected assist").label.label, "Extract into variable");
diff --git a/crates/ra_ide/src/assists.rs b/crates/ra_ide/src/assists.rs
index c3b2c638b6..b60b1a60d6 100644
--- a/crates/ra_ide/src/assists.rs
+++ b/crates/ra_ide/src/assists.rs
@@ -1,7 +1,7 @@
 //! FIXME: write short doc here
 
 use either::Either;
-use ra_assists::{AssistAction, AssistLabel};
+use ra_assists::{resolved_assists, AssistAction, AssistLabel};
 use ra_db::{FilePosition, FileRange};
 use ra_ide_db::RootDatabase;
 
@@ -17,7 +17,7 @@ pub struct Assist {
 }
 
 pub(crate) fn assists(db: &RootDatabase, frange: FileRange) -> Vec<Assist> {
-    ra_assists::assists(db, frange)
+    resolved_assists(db, frange)
         .into_iter()
         .map(|assist| {
             let file_id = frange.file_id;


Test patch:
diff --git a/crates/ra_assists/src/doc_tests.rs b/crates/ra_assists/src/doc_tests.rs
index 56020028cf..ae0e5605c1 100644
--- a/crates/ra_assists/src/doc_tests.rs
+++ b/crates/ra_assists/src/doc_tests.rs
@@ -8,19 +8,21 @@ mod generated;
 use ra_db::FileRange;
 use test_utils::{assert_eq_text, extract_range_or_offset};
 
+use crate::resolved_assists;
+
 fn check(assist_id: &str, before: &str, after: &str) {
     let (selection, before) = extract_range_or_offset(before);
     let (db, file_id) = crate::helpers::with_single_file(&before);
     let frange = FileRange { file_id, range: selection.into() };
 
-    let assist = crate::assists(&db, frange)
+    let assist = resolved_assists(&db, frange)
         .into_iter()
         .find(|assist| assist.label.id.0 == assist_id)
         .unwrap_or_else(|| {
             panic!(
                 "\n\nAssist is not applicable: {}\nAvailable assists: {}",
                 assist_id,
-                crate::assists(&db, frange)
+                resolved_assists(&db, frange)
                     .into_iter()
                     .map(|assist| assist.label.id.0)
                     .collect::<Vec<_>>()