From 11f3c8afb23d67acde8cc7642aea3a2ca06a2361 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 15 Jan 2019 18:13:11 +0300 Subject: remove Cancelable from source binders --- crates/ra_ide_api/src/completion/completion_context.rs | 2 +- crates/ra_ide_api/src/goto_definition.rs | 7 +++---- crates/ra_ide_api/src/hover.rs | 2 +- crates/ra_ide_api/src/imp.rs | 8 ++++---- crates/ra_ide_api/src/parent_module.rs | 2 +- crates/ra_ide_api/src/runnables.rs | 3 +-- crates/ra_ide_api/src/symbol_index.rs | 2 +- 7 files changed, 12 insertions(+), 14 deletions(-) (limited to 'crates/ra_ide_api/src') diff --git a/crates/ra_ide_api/src/completion/completion_context.rs b/crates/ra_ide_api/src/completion/completion_context.rs index 113f6c070..f5b5ed689 100644 --- a/crates/ra_ide_api/src/completion/completion_context.rs +++ b/crates/ra_ide_api/src/completion/completion_context.rs @@ -42,7 +42,7 @@ impl<'a> CompletionContext<'a> { original_file: &'a SourceFile, position: FilePosition, ) -> Cancelable>> { - let module = source_binder::module_from_position(db, position)?; + let module = source_binder::module_from_position(db, position); let leaf = ctry!(find_leaf_at_offset(original_file.syntax(), position.offset).left_biased()); let mut ctx = CompletionContext { diff --git a/crates/ra_ide_api/src/goto_definition.rs b/crates/ra_ide_api/src/goto_definition.rs index 332a2fb8d..f759f7339 100644 --- a/crates/ra_ide_api/src/goto_definition.rs +++ b/crates/ra_ide_api/src/goto_definition.rs @@ -48,7 +48,7 @@ pub(crate) fn reference_definition( ) -> Cancelable { use self::ReferenceResult::*; if let Some(function) = - hir::source_binder::function_from_child_node(db, file_id, name_ref.syntax())? + hir::source_binder::function_from_child_node(db, file_id, name_ref.syntax()) { let scope = function.scopes(db)?; // First try to resolve the symbol locally @@ -77,8 +77,7 @@ pub(crate) fn reference_definition( } } // Then try module name resolution - if let Some(module) = - hir::source_binder::module_from_child_node(db, file_id, name_ref.syntax())? + if let Some(module) = hir::source_binder::module_from_child_node(db, file_id, name_ref.syntax()) { if let Some(path) = name_ref .syntax() @@ -111,7 +110,7 @@ fn name_definition( if let Some(module) = name.syntax().parent().and_then(ast::Module::cast) { if module.has_semi() { if let Some(child_module) = - hir::source_binder::module_from_declaration(db, file_id, module)? + hir::source_binder::module_from_declaration(db, file_id, module) { let nav = NavigationTarget::from_module(db, child_module)?; return Ok(Some(vec![nav])); diff --git a/crates/ra_ide_api/src/hover.rs b/crates/ra_ide_api/src/hover.rs index 107b23833..26f3ced70 100644 --- a/crates/ra_ide_api/src/hover.rs +++ b/crates/ra_ide_api/src/hover.rs @@ -72,7 +72,7 @@ pub(crate) fn type_of(db: &RootDatabase, frange: FileRange) -> Cancelable