From bd04416aaae29ab572f1c91ba7a1ec7501b3f53c Mon Sep 17 00:00:00 2001 From: Maybe Waffle Date: Sat, 14 Jan 2023 12:50:13 +0000 Subject: [PATCH] Iterate over arrays dirrectly, instead of going through a slice --- crates/hir-ty/src/infer/expr.rs | 2 +- crates/ide-completion/src/completions/item_list/trait_impl.rs | 2 +- crates/ide-db/src/line_index.rs | 4 ++-- xtask/src/release/changelog.rs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/hir-ty/src/infer/expr.rs b/crates/hir-ty/src/infer/expr.rs index ea04a3d17b..3f78806bd7 100644 --- a/crates/hir-ty/src/infer/expr.rs +++ b/crates/hir-ty/src/infer/expr.rs @@ -1269,7 +1269,7 @@ impl<'a> InferenceContext<'a> { // that are not closures, then we type-check the closures. This is so // that we have more information about the types of arguments when we // type-check the functions. This isn't really the right way to do this. - for &check_closures in &[false, true] { + for check_closures in [false, true] { let mut skip_indices = skip_indices.into_iter().copied().fuse().peekable(); let param_iter = param_tys.iter().cloned().chain(repeat(self.err_ty())); let expected_iter = expected_inputs diff --git a/crates/ide-completion/src/completions/item_list/trait_impl.rs b/crates/ide-completion/src/completions/item_list/trait_impl.rs index 9a060857e9..889d90095f 100644 --- a/crates/ide-completion/src/completions/item_list/trait_impl.rs +++ b/crates/ide-completion/src/completions/item_list/trait_impl.rs @@ -869,7 +869,7 @@ impl Test for T {{ }; // Enumerate some possible next siblings. - for next_sibling in &[ + for next_sibling in [ "", "fn other_fn() {}", // `const $0 fn` -> `const fn` "type OtherType = i32;", diff --git a/crates/ide-db/src/line_index.rs b/crates/ide-db/src/line_index.rs index 1b8f56187a..8f12ab3340 100644 --- a/crates/ide-db/src/line_index.rs +++ b/crates/ide-db/src/line_index.rs @@ -185,14 +185,14 @@ mod tests { ]; let index = LineIndex::new(text); - for &(offset, line, col) in &table { + for (offset, line, col) in table { assert_eq!(index.line_col(offset.into()), LineCol { line, col }); } let text = "\nhello\nworld"; let table = [(0, 0, 0), (1, 1, 0), (2, 1, 1), (6, 1, 5), (7, 2, 0)]; let index = LineIndex::new(text); - for &(offset, line, col) in &table { + for (offset, line, col) in table { assert_eq!(index.line_col(offset.into()), LineCol { line, col }); } } diff --git a/xtask/src/release/changelog.rs b/xtask/src/release/changelog.rs index d2a1483e38..abf4d7a2e1 100644 --- a/xtask/src/release/changelog.rs +++ b/xtask/src/release/changelog.rs @@ -156,7 +156,7 @@ fn parse_title_line(s: &str) -> PrInfo { ("minor: ", PrKind::Skip), ]; - for &(prefix, kind) in &PREFIXES { + for (prefix, kind) in PREFIXES { if lower.starts_with(prefix) { let message = match &kind { PrKind::Skip => None,