diff options
Diffstat (limited to 'crates/ra_ide_api/src/lib.rs')
-rw-r--r-- | crates/ra_ide_api/src/lib.rs | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/crates/ra_ide_api/src/lib.rs b/crates/ra_ide_api/src/lib.rs index f18eb09ae..ea5267ad9 100644 --- a/crates/ra_ide_api/src/lib.rs +++ b/crates/ra_ide_api/src/lib.rs | |||
@@ -9,15 +9,6 @@ | |||
9 | //! | 9 | //! |
10 | //! The sibling `ra_ide_api_light` handles thouse bits of IDE functionality | 10 | //! The sibling `ra_ide_api_light` handles thouse bits of IDE functionality |
11 | //! which are restricted to a single file and need only syntax. | 11 | //! which are restricted to a single file and need only syntax. |
12 | macro_rules! ctry { | ||
13 | ($expr:expr) => { | ||
14 | match $expr { | ||
15 | None => return Ok(None), | ||
16 | Some(it) => it, | ||
17 | } | ||
18 | }; | ||
19 | } | ||
20 | |||
21 | mod db; | 12 | mod db; |
22 | mod imp; | 13 | mod imp; |
23 | pub mod mock_analysis; | 14 | pub mod mock_analysis; |
@@ -400,7 +391,7 @@ impl Analysis { | |||
400 | 391 | ||
401 | /// Finds all usages of the reference at point. | 392 | /// Finds all usages of the reference at point. |
402 | pub fn find_all_refs(&self, position: FilePosition) -> Cancelable<Vec<(FileId, TextRange)>> { | 393 | pub fn find_all_refs(&self, position: FilePosition) -> Cancelable<Vec<(FileId, TextRange)>> { |
403 | self.with_db(|db| db.find_all_refs(position))? | 394 | self.with_db(|db| db.find_all_refs(position)) |
404 | } | 395 | } |
405 | 396 | ||
406 | /// Returns a short text descrbing element at position. | 397 | /// Returns a short text descrbing element at position. |
@@ -445,7 +436,7 @@ impl Analysis { | |||
445 | pub fn completions(&self, position: FilePosition) -> Cancelable<Option<Vec<CompletionItem>>> { | 436 | pub fn completions(&self, position: FilePosition) -> Cancelable<Option<Vec<CompletionItem>>> { |
446 | let completions = self | 437 | let completions = self |
447 | .db | 438 | .db |
448 | .catch_canceled(|db| completion::completions(db, position))??; | 439 | .catch_canceled(|db| completion::completions(db, position))?; |
449 | Ok(completions.map(|it| it.into())) | 440 | Ok(completions.map(|it| it.into())) |
450 | } | 441 | } |
451 | 442 | ||
@@ -472,7 +463,7 @@ impl Analysis { | |||
472 | position: FilePosition, | 463 | position: FilePosition, |
473 | new_name: &str, | 464 | new_name: &str, |
474 | ) -> Cancelable<Vec<SourceFileEdit>> { | 465 | ) -> Cancelable<Vec<SourceFileEdit>> { |
475 | self.with_db(|db| db.rename(position, new_name))? | 466 | self.with_db(|db| db.rename(position, new_name)) |
476 | } | 467 | } |
477 | 468 | ||
478 | fn with_db<F: FnOnce(&db::RootDatabase) -> T + std::panic::UnwindSafe, T>( | 469 | fn with_db<F: FnOnce(&db::RootDatabase) -> T + std::panic::UnwindSafe, T>( |