diff options
author | Kirill Bulatov <[email protected]> | 2020-02-18 13:32:19 +0000 |
---|---|---|
committer | Kirill Bulatov <[email protected]> | 2020-02-18 14:12:37 +0000 |
commit | eceaf94f1936436e33ae235ca65bf2a6d4f77da5 (patch) | |
tree | 83d42e6f014f80b84f9193e6b5c7c1e2aded9fa7 /crates/ra_assists/src/handlers/add_custom_impl.rs | |
parent | b8ddcb0652f3ec8683023afc1e1f5166d6a712f4 (diff) |
More manual clippy fixes
Diffstat (limited to 'crates/ra_assists/src/handlers/add_custom_impl.rs')
-rw-r--r-- | crates/ra_assists/src/handlers/add_custom_impl.rs | 4 |
1 files changed, 2 insertions, 2 deletions
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<Assist> { | |||
43 | .clone(); | 43 | .clone(); |
44 | 44 | ||
45 | let trait_token = | 45 | let trait_token = |
46 | ctx.token_at_offset().filter(|t| t.kind() == IDENT && *t.text() != attr_name).next()?; | 46 | ctx.token_at_offset().find(|t| t.kind() == IDENT && *t.text() != attr_name)?; |
47 | 47 | ||
48 | let annotated = attr.syntax().siblings(Direction::Next).find_map(ast::Name::cast)?; | 48 | let annotated = attr.syntax().siblings(Direction::Next).find_map(ast::Name::cast)?; |
49 | let annotated_name = annotated.syntax().text().to_string(); | 49 | let annotated_name = annotated.syntax().text().to_string(); |
@@ -86,7 +86,7 @@ pub(crate) fn add_custom_impl(ctx: AssistCtx) -> Option<Assist> { | |||
86 | .next_sibling_or_token() | 86 | .next_sibling_or_token() |
87 | .filter(|t| t.kind() == WHITESPACE) | 87 | .filter(|t| t.kind() == WHITESPACE) |
88 | .map(|t| t.text_range()) | 88 | .map(|t| t.text_range()) |
89 | .unwrap_or(TextRange::from_to(TextUnit::from(0), TextUnit::from(0))); | 89 | .unwrap_or_else(|| TextRange::from_to(TextUnit::from(0), TextUnit::from(0))); |
90 | edit.delete(line_break_range); | 90 | edit.delete(line_break_range); |
91 | 91 | ||
92 | attr_range.len() + line_break_range.len() | 92 | attr_range.len() + line_break_range.len() |