From 6753051a45e067fb8267f7ecbbf1b894558718d1 Mon Sep 17 00:00:00 2001 From: kjeremy Date: Wed, 6 Feb 2019 15:50:26 -0500 Subject: Some clippy cleanups --- crates/ra_lsp_server/src/conv.rs | 7 ++---- crates/ra_lsp_server/src/main_loop/handlers.rs | 34 ++++++++++++-------------- 2 files changed, 17 insertions(+), 24 deletions(-) (limited to 'crates/ra_lsp_server/src') diff --git a/crates/ra_lsp_server/src/conv.rs b/crates/ra_lsp_server/src/conv.rs index 17fa07340..981385466 100644 --- a/crates/ra_lsp_server/src/conv.rs +++ b/crates/ra_lsp_server/src/conv.rs @@ -169,10 +169,7 @@ impl ConvWith for TextEdit { type Output = Vec; fn conv_with(self, line_index: &LineIndex) -> Vec { - self.as_atoms() - .into_iter() - .map_conv_with(line_index) - .collect() + self.as_atoms().iter().map_conv_with(line_index).collect() } } @@ -394,7 +391,7 @@ pub fn to_location_link( origin_selection_range: Some(target.range.conv_with(line_index)), target_uri, target_range, - target_selection_range: target_selection_range, + target_selection_range, }; Ok(res) } diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs index ab2b81bf0..aa55d1255 100644 --- a/crates/ra_lsp_server/src/main_loop/handlers.rs +++ b/crates/ra_lsp_server/src/main_loop/handlers.rs @@ -123,7 +123,7 @@ pub fn handle_on_type_formatting( let edit = edit.source_file_edits.pop().unwrap(); let change: Vec = edit.edit.conv_with(&line_index); - return Ok(Some(change)); + Ok(Some(change)) } pub fn handle_document_symbol( @@ -319,7 +319,7 @@ pub fn handle_runnables( args: check_args, env: FxHashMap::default(), }); - return Ok(res); + Ok(res) } pub fn handle_decorations( @@ -622,10 +622,8 @@ pub fn handle_code_lens( // Gather runnables for runnable in world.analysis().runnables(file_id)? { let title = match &runnable.kind { - RunnableKind::Test { name: _ } | RunnableKind::TestMod { path: _ } => { - Some("▶️Run Test") - } - RunnableKind::Bench { name: _ } => Some("Run Bench"), + RunnableKind::Test { .. } | RunnableKind::TestMod { .. } => Some("▶️Run Test"), + RunnableKind::Bench { .. } => Some("Run Bench"), _ => None, }; @@ -679,7 +677,7 @@ pub fn handle_code_lens( }), ); - return Ok(Some(lenses)); + Ok(Some(lenses)) } #[derive(Debug, Serialize, Deserialize)] @@ -722,22 +720,20 @@ pub fn handle_code_lens_resolve(world: ServerWorld, code_lens: CodeLens) -> Resu to_value(locations).unwrap(), ]), }; - return Ok(CodeLens { + Ok(CodeLens { range: code_lens.range, command: Some(cmd), data: None, - }); - } - None => { - return Ok(CodeLens { - range: code_lens.range, - command: Some(Command { - title: "Error".into(), - ..Default::default() - }), - data: None, - }); + }) } + None => Ok(CodeLens { + range: code_lens.range, + command: Some(Command { + title: "Error".into(), + ..Default::default() + }), + data: None, + }), } } -- cgit v1.2.3