From b042faeb64d858c26b05dbf543925bf626454282 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 8 Jul 2019 13:47:02 +0300 Subject: simplify --- crates/ra_lsp_server/src/main_loop/handlers.rs | 30 ++++++-------------------- 1 file changed, 7 insertions(+), 23 deletions(-) (limited to 'crates/ra_lsp_server/src/main_loop/handlers.rs') diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs index 8f07f5027..ab9ed5080 100644 --- a/crates/ra_lsp_server/src/main_loop/handlers.rs +++ b/crates/ra_lsp_server/src/main_loop/handlers.rs @@ -9,8 +9,7 @@ use lsp_types::{ TextDocumentIdentifier, TextEdit, WorkspaceEdit, }; use ra_ide_api::{ - AssistId, Cancelable, FileId, FilePosition, FileRange, FoldKind, Query, RangeInfo, - RunnableKind, Severity, + AssistId, Cancelable, FileId, FilePosition, FileRange, FoldKind, Query, RunnableKind, Severity, }; use ra_prof::profile; use ra_syntax::{AstNode, SyntaxKind, TextRange, TextUnit}; @@ -267,13 +266,8 @@ pub fn handle_goto_definition( None => return Ok(None), Some(it) => it, }; - let nav_range = nav_info.range; - let res = nav_info - .info - .into_iter() - .map(|nav| (position.file_id, RangeInfo::new(nav_range, nav))) - .try_conv_with_to_vec(&world)?; - Ok(Some(res.into())) + let res = (position.file_id, nav_info).try_conv_with(&world)?; + Ok(Some(res)) } pub fn handle_goto_implementation( @@ -285,13 +279,8 @@ pub fn handle_goto_implementation( None => return Ok(None), Some(it) => it, }; - let nav_range = nav_info.range; - let res = nav_info - .info - .into_iter() - .map(|nav| (position.file_id, RangeInfo::new(nav_range, nav))) - .try_conv_with_to_vec(&world)?; - Ok(Some(res.into())) + let res = (position.file_id, nav_info).try_conv_with(&world)?; + Ok(Some(res)) } pub fn handle_goto_type_definition( @@ -303,13 +292,8 @@ pub fn handle_goto_type_definition( None => return Ok(None), Some(it) => it, }; - let nav_range = nav_info.range; - let res = nav_info - .info - .into_iter() - .map(|nav| (position.file_id, RangeInfo::new(nav_range, nav))) - .try_conv_with_to_vec(&world)?; - Ok(Some(res.into())) + let res = (position.file_id, nav_info).try_conv_with(&world)?; + Ok(Some(res)) } pub fn handle_parent_module( -- cgit v1.2.3