From e8dfb92641f64b772204d7670c7286cb9b8b398b Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 22 Aug 2018 12:58:34 +0300 Subject: Simplify --- crates/server/src/main_loop/handlers.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'crates/server/src/main_loop/handlers.rs') diff --git a/crates/server/src/main_loop/handlers.rs b/crates/server/src/main_loop/handlers.rs index 16cc92464..9ff821a8b 100644 --- a/crates/server/src/main_loop/handlers.rs +++ b/crates/server/src/main_loop/handlers.rs @@ -6,7 +6,7 @@ use languageserver_types::{ SymbolInformation, Position, Location, }; use libanalysis::{Query}; -use libeditor::{self, CursorPosition}; +use libeditor; use libsyntax2::TextUnit; use serde_json::{to_value, from_value}; @@ -230,11 +230,8 @@ pub fn handle_execute_command( document_changes: None, }; let edit = req::ApplyWorkspaceEditParams { edit }; - let cursor_pos = match action_result.cursor_position { - CursorPosition::Same => None, - CursorPosition::Offset(offset) => Some(offset.conv_with(&line_index)), - }; - + let cursor_pos = action_result.cursor_position + .map(|off| off.conv_with(&line_index)); Ok((edit, cursor_pos)) } -- cgit v1.2.3