From eceaf94f1936436e33ae235ca65bf2a6d4f77da5 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Tue, 18 Feb 2020 15:32:19 +0200 Subject: More manual clippy fixes --- crates/ra_assists/src/handlers/add_custom_impl.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/ra_assists/src/handlers/add_custom_impl.rs') diff --git a/crates/ra_assists/src/handlers/add_custom_impl.rs b/crates/ra_assists/src/handlers/add_custom_impl.rs index 4d3a72c18..74aa4b001 100644 --- a/crates/ra_assists/src/handlers/add_custom_impl.rs +++ b/crates/ra_assists/src/handlers/add_custom_impl.rs @@ -43,7 +43,7 @@ pub(crate) fn add_custom_impl(ctx: AssistCtx) -> Option { .clone(); let trait_token = - ctx.token_at_offset().filter(|t| t.kind() == IDENT && *t.text() != attr_name).next()?; + ctx.token_at_offset().find(|t| t.kind() == IDENT && *t.text() != attr_name)?; let annotated = attr.syntax().siblings(Direction::Next).find_map(ast::Name::cast)?; let annotated_name = annotated.syntax().text().to_string(); @@ -86,7 +86,7 @@ pub(crate) fn add_custom_impl(ctx: AssistCtx) -> Option { .next_sibling_or_token() .filter(|t| t.kind() == WHITESPACE) .map(|t| t.text_range()) - .unwrap_or(TextRange::from_to(TextUnit::from(0), TextUnit::from(0))); + .unwrap_or_else(|| TextRange::from_to(TextUnit::from(0), TextUnit::from(0))); edit.delete(line_break_range); attr_range.len() + line_break_range.len() -- cgit v1.2.3