From b441b4e8effeaf4532fd2e45c4d864480857c49e Mon Sep 17 00:00:00 2001 From: kjeremy Date: Wed, 30 Oct 2019 13:36:37 -0400 Subject: Some clippy fixes --- crates/ra_assists/src/assists/early_return.rs | 2 +- crates/ra_assists/src/assists/inline_local_variable.rs | 6 ++---- crates/ra_assists/src/assists/raw_string.rs | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) (limited to 'crates/ra_assists/src') diff --git a/crates/ra_assists/src/assists/early_return.rs b/crates/ra_assists/src/assists/early_return.rs index e839d831e..ad6c5695a 100644 --- a/crates/ra_assists/src/assists/early_return.rs +++ b/crates/ra_assists/src/assists/early_return.rs @@ -50,7 +50,7 @@ pub(crate) fn convert_to_guarded_return(ctx: AssistCtx) -> Opt } // check for early return and continue - let first_in_then_block = then_block.syntax().first_child()?.clone(); + let first_in_then_block = then_block.syntax().first_child()?; if ast::ReturnExpr::can_cast(first_in_then_block.kind()) || ast::ContinueExpr::can_cast(first_in_then_block.kind()) || first_in_then_block diff --git a/crates/ra_assists/src/assists/inline_local_variable.rs b/crates/ra_assists/src/assists/inline_local_variable.rs index f43910574..a7fd9b6d2 100644 --- a/crates/ra_assists/src/assists/inline_local_variable.rs +++ b/crates/ra_assists/src/assists/inline_local_variable.rs @@ -51,10 +51,8 @@ pub(crate) fn inline_local_varialbe(ctx: AssistCtx) -> Option< let mut wrap_in_parens = vec![true; refs.len()]; for (i, desc) in refs.iter().enumerate() { - let usage_node = ctx - .covering_node_for_range(desc.range) - .ancestors() - .find_map(|node| ast::PathExpr::cast(node))?; + let usage_node = + ctx.covering_node_for_range(desc.range).ancestors().find_map(ast::PathExpr::cast)?; let usage_parent_option = usage_node.syntax().parent().and_then(ast::Expr::cast); let usage_parent = match usage_parent_option { Some(u) => u, diff --git a/crates/ra_assists/src/assists/raw_string.rs b/crates/ra_assists/src/assists/raw_string.rs index 6f4b66c31..58f7157ae 100644 --- a/crates/ra_assists/src/assists/raw_string.rs +++ b/crates/ra_assists/src/assists/raw_string.rs @@ -131,7 +131,7 @@ pub(crate) fn remove_hash(ctx: AssistCtx) -> Option { ctx.add_assist(AssistId("remove_hash"), "remove hash from raw string", |edit| { edit.target(token.text_range()); let result = &text[2..text.len() - 1]; - let result = if result.starts_with("\"") { + let result = if result.starts_with('\"') { // no more hash, escape let internal_str = &result[1..result.len() - 1]; format!("\"{}\"", internal_str.escape_default().to_string()) -- cgit v1.2.3