aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_assists/src')
-rw-r--r--crates/ra_assists/src/doc_tests.rs4
-rw-r--r--crates/ra_assists/src/lib.rs20
2 files changed, 12 insertions, 12 deletions
diff --git a/crates/ra_assists/src/doc_tests.rs b/crates/ra_assists/src/doc_tests.rs
index 6e1e3de84..43194037e 100644
--- a/crates/ra_assists/src/doc_tests.rs
+++ b/crates/ra_assists/src/doc_tests.rs
@@ -6,12 +6,12 @@
6mod generated; 6mod generated;
7 7
8use hir::mock::MockDatabase; 8use hir::mock::MockDatabase;
9use ra_db::FileRange; 9use ra_db::{fixture::WithFixture, FileRange};
10use test_utils::{assert_eq_text, extract_range_or_offset}; 10use test_utils::{assert_eq_text, extract_range_or_offset};
11 11
12fn check(assist_id: &str, before: &str, after: &str) { 12fn check(assist_id: &str, before: &str, after: &str) {
13 let (selection, before) = extract_range_or_offset(before); 13 let (selection, before) = extract_range_or_offset(before);
14 let (db, _source_root, file_id) = MockDatabase::with_single_file(&before); 14 let (db, file_id) = MockDatabase::with_single_file(&before);
15 let frange = FileRange { file_id, range: selection.into() }; 15 let frange = FileRange { file_id, range: selection.into() };
16 16
17 let (_assist_id, action) = crate::assists(&db, frange) 17 let (_assist_id, action) = crate::assists(&db, frange)
diff --git a/crates/ra_assists/src/lib.rs b/crates/ra_assists/src/lib.rs
index 38599d4f1..13db37d29 100644
--- a/crates/ra_assists/src/lib.rs
+++ b/crates/ra_assists/src/lib.rs
@@ -147,7 +147,7 @@ mod assists {
147#[cfg(test)] 147#[cfg(test)]
148mod helpers { 148mod helpers {
149 use hir::mock::MockDatabase; 149 use hir::mock::MockDatabase;
150 use ra_db::FileRange; 150 use ra_db::{fixture::WithFixture, FileRange};
151 use ra_syntax::TextRange; 151 use ra_syntax::TextRange;
152 use test_utils::{add_cursor, assert_eq_text, extract_offset, extract_range}; 152 use test_utils::{add_cursor, assert_eq_text, extract_offset, extract_range};
153 153
@@ -159,7 +159,7 @@ mod helpers {
159 after: &str, 159 after: &str,
160 ) { 160 ) {
161 let (before_cursor_pos, before) = extract_offset(before); 161 let (before_cursor_pos, before) = extract_offset(before);
162 let (db, _source_root, file_id) = MockDatabase::with_single_file(&before); 162 let (db, file_id) = MockDatabase::with_single_file(&before);
163 let frange = 163 let frange =
164 FileRange { file_id, range: TextRange::offset_len(before_cursor_pos, 0.into()) }; 164 FileRange { file_id, range: TextRange::offset_len(before_cursor_pos, 0.into()) };
165 let assist = 165 let assist =
@@ -187,7 +187,7 @@ mod helpers {
187 after: &str, 187 after: &str,
188 ) { 188 ) {
189 let (range, before) = extract_range(before); 189 let (range, before) = extract_range(before);
190 let (db, _source_root, file_id) = MockDatabase::with_single_file(&before); 190 let (db, file_id) = MockDatabase::with_single_file(&before);
191 let frange = FileRange { file_id, range }; 191 let frange = FileRange { file_id, range };
192 let assist = 192 let assist =
193 AssistCtx::with_ctx(&db, frange, true, assist).expect("code action is not applicable"); 193 AssistCtx::with_ctx(&db, frange, true, assist).expect("code action is not applicable");
@@ -209,7 +209,7 @@ mod helpers {
209 target: &str, 209 target: &str,
210 ) { 210 ) {
211 let (before_cursor_pos, before) = extract_offset(before); 211 let (before_cursor_pos, before) = extract_offset(before);
212 let (db, _source_root, file_id) = MockDatabase::with_single_file(&before); 212 let (db, file_id) = MockDatabase::with_single_file(&before);
213 let frange = 213 let frange =
214 FileRange { file_id, range: TextRange::offset_len(before_cursor_pos, 0.into()) }; 214 FileRange { file_id, range: TextRange::offset_len(before_cursor_pos, 0.into()) };
215 let assist = 215 let assist =
@@ -229,7 +229,7 @@ mod helpers {
229 target: &str, 229 target: &str,
230 ) { 230 ) {
231 let (range, before) = extract_range(before); 231 let (range, before) = extract_range(before);
232 let (db, _source_root, file_id) = MockDatabase::with_single_file(&before); 232 let (db, file_id) = MockDatabase::with_single_file(&before);
233 let frange = FileRange { file_id, range }; 233 let frange = FileRange { file_id, range };
234 let assist = 234 let assist =
235 AssistCtx::with_ctx(&db, frange, true, assist).expect("code action is not applicable"); 235 AssistCtx::with_ctx(&db, frange, true, assist).expect("code action is not applicable");
@@ -247,7 +247,7 @@ mod helpers {
247 before: &str, 247 before: &str,
248 ) { 248 ) {
249 let (before_cursor_pos, before) = extract_offset(before); 249 let (before_cursor_pos, before) = extract_offset(before);
250 let (db, _source_root, file_id) = MockDatabase::with_single_file(&before); 250 let (db, file_id) = MockDatabase::with_single_file(&before);
251 let frange = 251 let frange =
252 FileRange { file_id, range: TextRange::offset_len(before_cursor_pos, 0.into()) }; 252 FileRange { file_id, range: TextRange::offset_len(before_cursor_pos, 0.into()) };
253 let assist = AssistCtx::with_ctx(&db, frange, true, assist); 253 let assist = AssistCtx::with_ctx(&db, frange, true, assist);
@@ -259,7 +259,7 @@ mod helpers {
259 before: &str, 259 before: &str,
260 ) { 260 ) {
261 let (range, before) = extract_range(before); 261 let (range, before) = extract_range(before);
262 let (db, _source_root, file_id) = MockDatabase::with_single_file(&before); 262 let (db, file_id) = MockDatabase::with_single_file(&before);
263 let frange = FileRange { file_id, range }; 263 let frange = FileRange { file_id, range };
264 let assist = AssistCtx::with_ctx(&db, frange, true, assist); 264 let assist = AssistCtx::with_ctx(&db, frange, true, assist);
265 assert!(assist.is_none()); 265 assert!(assist.is_none());
@@ -269,7 +269,7 @@ mod helpers {
269#[cfg(test)] 269#[cfg(test)]
270mod tests { 270mod tests {
271 use hir::mock::MockDatabase; 271 use hir::mock::MockDatabase;
272 use ra_db::FileRange; 272 use ra_db::{fixture::WithFixture, FileRange};
273 use ra_syntax::TextRange; 273 use ra_syntax::TextRange;
274 use test_utils::{extract_offset, extract_range}; 274 use test_utils::{extract_offset, extract_range};
275 275
@@ -277,7 +277,7 @@ mod tests {
277 fn assist_order_field_struct() { 277 fn assist_order_field_struct() {
278 let before = "struct Foo { <|>bar: u32 }"; 278 let before = "struct Foo { <|>bar: u32 }";
279 let (before_cursor_pos, before) = extract_offset(before); 279 let (before_cursor_pos, before) = extract_offset(before);
280 let (db, _source_root, file_id) = MockDatabase::with_single_file(&before); 280 let (db, file_id) = MockDatabase::with_single_file(&before);
281 let frange = 281 let frange =
282 FileRange { file_id, range: TextRange::offset_len(before_cursor_pos, 0.into()) }; 282 FileRange { file_id, range: TextRange::offset_len(before_cursor_pos, 0.into()) };
283 let assists = super::assists(&db, frange); 283 let assists = super::assists(&db, frange);
@@ -298,7 +298,7 @@ mod tests {
298 } 298 }
299 }"; 299 }";
300 let (range, before) = extract_range(before); 300 let (range, before) = extract_range(before);
301 let (db, _source_root, file_id) = MockDatabase::with_single_file(&before); 301 let (db, file_id) = MockDatabase::with_single_file(&before);
302 let frange = FileRange { file_id, range }; 302 let frange = FileRange { file_id, range };
303 let assists = super::assists(&db, frange); 303 let assists = super::assists(&db, frange);
304 let mut assists = assists.iter(); 304 let mut assists = assists.iter();