Skip to content

Commit 9e12b9e

Browse files
bors[bot]matklad
andauthored
Merge #3771
3771: Use IntoIter r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 parents d2ea3f2 + 0cfa9eb commit 9e12b9e

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

crates/ra_assists/src/handlers/fill_match_arms.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,7 @@ pub(crate) fn fill_match_arms(ctx: AssistCtx) -> Option<Assist> {
9797
}
9898

9999
ctx.add_assist(AssistId("fill_match_arms"), "Fill match arms", |edit| {
100-
let new_arm_list =
101-
match_arm_list.remove_placeholder().append_arms(missing_arms.into_iter());
100+
let new_arm_list = match_arm_list.remove_placeholder().append_arms(missing_arms);
102101

103102
edit.target(match_expr.syntax().text_range());
104103
edit.set_cursor(expr.syntax().text_range().start());

crates/ra_syntax/src/ast/edit.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,12 @@ where
8080

8181
impl ast::ItemList {
8282
#[must_use]
83-
pub fn append_items(&self, items: impl Iterator<Item = ast::ImplItem>) -> ast::ItemList {
83+
pub fn append_items(&self, items: impl IntoIterator<Item = ast::ImplItem>) -> ast::ItemList {
8484
let mut res = self.clone();
8585
if !self.syntax().text().contains_char('\n') {
8686
res = make_multiline(res);
8787
}
88-
items.for_each(|it| res = res.append_item(it));
88+
items.into_iter().for_each(|it| res = res.append_item(it));
8989
res
9090
}
9191

@@ -339,13 +339,13 @@ impl ast::UseTree {
339339

340340
impl ast::MatchArmList {
341341
#[must_use]
342-
pub fn append_arms(&self, items: impl Iterator<Item = ast::MatchArm>) -> ast::MatchArmList {
342+
pub fn append_arms(&self, items: impl IntoIterator<Item = ast::MatchArm>) -> ast::MatchArmList {
343343
let mut res = self.clone();
344344
res = res.strip_if_only_whitespace();
345345
if !res.syntax().text().contains_char('\n') {
346346
res = make_multiline(res);
347347
}
348-
items.for_each(|it| res = res.append_arm(it));
348+
items.into_iter().for_each(|it| res = res.append_arm(it));
349349
res
350350
}
351351

0 commit comments

Comments
 (0)