diff options
Diffstat (limited to 'crates/ide_assists')
-rw-r--r-- | crates/ide_assists/src/handlers/convert_comment_block.rs | 5 | ||||
-rw-r--r-- | crates/ide_assists/src/handlers/expand_glob_import.rs | 19 | ||||
-rw-r--r-- | crates/ide_assists/src/handlers/reorder_impl.rs | 2 |
3 files changed, 10 insertions, 16 deletions
diff --git a/crates/ide_assists/src/handlers/convert_comment_block.rs b/crates/ide_assists/src/handlers/convert_comment_block.rs index cdc45fc42..9dc3ee28f 100644 --- a/crates/ide_assists/src/handlers/convert_comment_block.rs +++ b/crates/ide_assists/src/handlers/convert_comment_block.rs | |||
@@ -1,5 +1,4 @@ | |||
1 | use itertools::Itertools; | 1 | use itertools::Itertools; |
2 | use std::convert::identity; | ||
3 | use syntax::{ | 2 | use syntax::{ |
4 | ast::{ | 3 | ast::{ |
5 | self, | 4 | self, |
@@ -140,7 +139,7 @@ fn relevant_line_comments(comment: &ast::Comment) -> Vec<Comment> { | |||
140 | .filter(|s| !skippable(s)) | 139 | .filter(|s| !skippable(s)) |
141 | .map(|not| not.into_token().and_then(Comment::cast).filter(same_prefix)) | 140 | .map(|not| not.into_token().and_then(Comment::cast).filter(same_prefix)) |
142 | .take_while(|opt_com| opt_com.is_some()) | 141 | .take_while(|opt_com| opt_com.is_some()) |
143 | .filter_map(identity) | 142 | .flatten() |
144 | .skip(1); // skip the first element so we don't duplicate it in next_comments | 143 | .skip(1); // skip the first element so we don't duplicate it in next_comments |
145 | 144 | ||
146 | let next_comments = comment | 145 | let next_comments = comment |
@@ -149,7 +148,7 @@ fn relevant_line_comments(comment: &ast::Comment) -> Vec<Comment> { | |||
149 | .filter(|s| !skippable(s)) | 148 | .filter(|s| !skippable(s)) |
150 | .map(|not| not.into_token().and_then(Comment::cast).filter(same_prefix)) | 149 | .map(|not| not.into_token().and_then(Comment::cast).filter(same_prefix)) |
151 | .take_while(|opt_com| opt_com.is_some()) | 150 | .take_while(|opt_com| opt_com.is_some()) |
152 | .filter_map(identity); | 151 | .flatten(); |
153 | 152 | ||
154 | let mut comments: Vec<_> = prev_comments.collect(); | 153 | let mut comments: Vec<_> = prev_comments.collect(); |
155 | comments.reverse(); | 154 | comments.reverse(); |
diff --git a/crates/ide_assists/src/handlers/expand_glob_import.rs b/crates/ide_assists/src/handlers/expand_glob_import.rs index 83aa11d52..98389e4f7 100644 --- a/crates/ide_assists/src/handlers/expand_glob_import.rs +++ b/crates/ide_assists/src/handlers/expand_glob_import.rs | |||
@@ -136,18 +136,13 @@ impl Refs { | |||
136 | .into_iter() | 136 | .into_iter() |
137 | .filter(|r| { | 137 | .filter(|r| { |
138 | if let Def::ModuleDef(ModuleDef::Trait(tr)) = r.def { | 138 | if let Def::ModuleDef(ModuleDef::Trait(tr)) = r.def { |
139 | if tr | 139 | if tr.items(ctx.db()).into_iter().any(|ai| { |
140 | .items(ctx.db()) | 140 | if let AssocItem::Function(f) = ai { |
141 | .into_iter() | 141 | Def::ModuleDef(ModuleDef::Function(f)).is_referenced_in(ctx) |
142 | .find(|ai| { | 142 | } else { |
143 | if let AssocItem::Function(f) = *ai { | 143 | false |
144 | Def::ModuleDef(ModuleDef::Function(f)).is_referenced_in(ctx) | 144 | } |
145 | } else { | 145 | }) { |
146 | false | ||
147 | } | ||
148 | }) | ||
149 | .is_some() | ||
150 | { | ||
151 | return true; | 146 | return true; |
152 | } | 147 | } |
153 | } | 148 | } |
diff --git a/crates/ide_assists/src/handlers/reorder_impl.rs b/crates/ide_assists/src/handlers/reorder_impl.rs index edf4b0bfe..f976e73ad 100644 --- a/crates/ide_assists/src/handlers/reorder_impl.rs +++ b/crates/ide_assists/src/handlers/reorder_impl.rs | |||
@@ -95,7 +95,7 @@ fn compute_method_ranks(path: &ast::Path, ctx: &AssistContext) -> Option<FxHashM | |||
95 | _ => None, | 95 | _ => None, |
96 | }) | 96 | }) |
97 | .enumerate() | 97 | .enumerate() |
98 | .map(|(idx, func)| ((func.name(ctx.db()).to_string(), idx))) | 98 | .map(|(idx, func)| (func.name(ctx.db()).to_string(), idx)) |
99 | .collect(), | 99 | .collect(), |
100 | ) | 100 | ) |
101 | } | 101 | } |