From f32dc7135175c1e8a9ea81d7c18c21b2722f28c5 Mon Sep 17 00:00:00 2001 From: "Jeremy A. Kolb" Date: Thu, 29 Nov 2018 15:30:49 -0500 Subject: Clippy lints --- crates/ra_lsp_server/src/conv.rs | 11 +++-------- crates/ra_lsp_server/src/main.rs | 1 - crates/ra_lsp_server/src/main_loop/handlers.rs | 13 ++++++++----- crates/ra_lsp_server/src/path_map.rs | 4 ++-- 4 files changed, 13 insertions(+), 16 deletions(-) (limited to 'crates/ra_lsp_server') diff --git a/crates/ra_lsp_server/src/conv.rs b/crates/ra_lsp_server/src/conv.rs index 5d5a0c55e..28368787c 100644 --- a/crates/ra_lsp_server/src/conv.rs +++ b/crates/ra_lsp_server/src/conv.rs @@ -63,10 +63,7 @@ impl ConvWith for TextUnit { fn conv_with(self, line_index: &LineIndex) -> Position { let line_col = line_index.line_col(self); - Position::new( - u64::from(line_col.line), - u64::from(u32::from(line_col.col_utf16)), - ) + Position::new(u64::from(line_col.line), u64::from(line_col.col_utf16)) } } @@ -204,10 +201,8 @@ impl TryConvWith for SourceChange { .map(|it| it.edits.as_slice()) .unwrap_or(&[]); let line_col = translate_offset_with_edit(&*line_index, pos.offset, edits); - let position = Position::new( - u64::from(line_col.line), - u64::from(u32::from(line_col.col_utf16)), - ); + let position = + Position::new(u64::from(line_col.line), u64::from(line_col.col_utf16)); Some(TextDocumentPositionParams { text_document: TextDocumentIdentifier::new(pos.file_id.try_conv_with(world)?), position, diff --git a/crates/ra_lsp_server/src/main.rs b/crates/ra_lsp_server/src/main.rs index 26bcddd8e..173418520 100644 --- a/crates/ra_lsp_server/src/main.rs +++ b/crates/ra_lsp_server/src/main.rs @@ -2,7 +2,6 @@ extern crate log; #[macro_use] extern crate failure; -#[macro_use] extern crate serde_derive; extern crate serde; extern crate flexi_logger; diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs index 27933a7ae..6d5622b15 100644 --- a/crates/ra_lsp_server/src/main_loop/handlers.rs +++ b/crates/ra_lsp_server/src/main_loop/handlers.rs @@ -384,7 +384,7 @@ pub fn handle_completion( let completion_triggered_after_single_colon = { let mut res = false; if let Some(ctx) = params.context { - if ctx.trigger_character.unwrap_or(String::new()) == ":" { + if ctx.trigger_character.unwrap_or_default() == ":" { let source_file = world.analysis().file_syntax(position.file_id); let syntax = source_file.syntax(); let text = syntax.text(); @@ -567,10 +567,13 @@ pub fn handle_rename(world: ServerWorld, params: RenameParams) -> Result Option { - self.path2id.get(path).map(|&id| id) + self.path2id.get(path).cloned() } pub fn get_path(&self, file_id: FileId) -> &Path { self.id2path.get(&file_id).unwrap().as_path() -- cgit v1.2.3