about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBenjaminBrienen <Benjamin.Brienen@outlook.com>2025-03-10 12:41:51 +0100
committerBenjaminBrienen <Benjamin.Brienen@outlook.com>2025-03-15 21:32:01 +0100
commitb5b7a54e95f6a9220008f6e2cb95e2d03fe97e1c (patch)
treee7d335bb27d14283299cb0e3c582ca68db5dad10
parent87228245cf4e4ada84709b98e12f36db22b40a9e (diff)
downloadrust-b5b7a54e95f6a9220008f6e2cb95e2d03fe97e1c.tar.gz
rust-b5b7a54e95f6a9220008f6e2cb95e2d03fe97e1c.zip
cargo clippy --fix
-rw-r--r--src/tools/rust-analyzer/crates/hir-def/src/item_tree/lower.rs2
-rw-r--r--src/tools/rust-analyzer/crates/hir-ty/src/builder.rs6
-rw-r--r--src/tools/rust-analyzer/crates/hir-ty/src/infer/unify.rs4
-rw-r--r--src/tools/rust-analyzer/crates/hir-ty/src/mir/eval.rs4
-rw-r--r--src/tools/rust-analyzer/crates/hir-ty/src/mir/eval/shim/simd.rs2
-rw-r--r--src/tools/rust-analyzer/crates/ide/src/signature_help.rs6
-rw-r--r--src/tools/rust-analyzer/crates/rust-analyzer/src/lsp/to_proto.rs2
7 files changed, 13 insertions, 13 deletions
diff --git a/src/tools/rust-analyzer/crates/hir-def/src/item_tree/lower.rs b/src/tools/rust-analyzer/crates/hir-def/src/item_tree/lower.rs
index b0cc7ead8c0..3c85d5bacb4 100644
--- a/src/tools/rust-analyzer/crates/hir-def/src/item_tree/lower.rs
+++ b/src/tools/rust-analyzer/crates/hir-def/src/item_tree/lower.rs
@@ -932,7 +932,7 @@ impl<'a> Ctx<'a> {
 fn desugar_future_path(ctx: &mut LowerCtx<'_>, orig: TypeRefId) -> PathId {
     let path = path![core::future::Future];
     let mut generic_args: Vec<_> =
-        std::iter::repeat(None).take(path.segments().len() - 1).collect();
+        std::iter::repeat_n(None, path.segments().len() - 1).collect();
     let binding = AssociatedTypeBinding {
         name: Name::new_symbol_root(sym::Output.clone()),
         args: None,
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/builder.rs b/src/tools/rust-analyzer/crates/hir-ty/src/builder.rs
index 76d9c60f6f9..4c35db0c9b9 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/builder.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/builder.rs
@@ -263,7 +263,7 @@ impl TyBuilder<()> {
             .as_generic_def_id(db.upcast())
             .map(|p| generics(db.upcast(), p).placeholder_subst(db));
         // These represent resume type, yield type, and return type of coroutine.
-        let params = std::iter::repeat(ParamKind::Type).take(3).collect();
+        let params = std::iter::repeat_n(ParamKind::Type, 3).collect();
         TyBuilder::new((), params, parent_subst)
     }
 
@@ -340,7 +340,7 @@ impl TyBuilder<hir_def::AdtId> {
 pub struct Tuple(usize);
 impl TyBuilder<Tuple> {
     pub fn tuple(size: usize) -> TyBuilder<Tuple> {
-        TyBuilder::new(Tuple(size), iter::repeat(ParamKind::Type).take(size).collect(), None)
+        TyBuilder::new(Tuple(size), std::iter::repeat_n(ParamKind::Type, size).collect(), None)
     }
 
     pub fn build(self) -> Ty {
@@ -356,7 +356,7 @@ impl TyBuilder<Tuple> {
         let elements = elements.into_iter();
         let len = elements.len();
         let mut b =
-            TyBuilder::new(Tuple(len), iter::repeat(ParamKind::Type).take(len).collect(), None);
+            TyBuilder::new(Tuple(len), std::iter::repeat_n(ParamKind::Type, len).collect(), None);
         for e in elements {
             b = b.push(e);
         }
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/infer/unify.rs b/src/tools/rust-analyzer/crates/hir-ty/src/infer/unify.rs
index e55fc0a9b83..6d80bfc38e5 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/infer/unify.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/infer/unify.rs
@@ -1,6 +1,6 @@
 //! Unification and canonicalization logic.
 
-use std::{fmt, iter, mem};
+use std::{fmt, mem};
 
 use chalk_ir::{
     cast::Cast, fold::TypeFoldable, interner::HasInterner, zip::Zip, CanonicalVarKind, FloatTy,
@@ -386,7 +386,7 @@ impl<'a> InferenceTable<'a> {
     }
     fn extend_type_variable_table(&mut self, to_index: usize) {
         let count = to_index - self.type_variable_table.len() + 1;
-        self.type_variable_table.extend(iter::repeat(TypeVariableFlags::default()).take(count));
+        self.type_variable_table.extend(std::iter::repeat_n(TypeVariableFlags::default(), count));
     }
 
     fn new_var(&mut self, kind: TyVariableKind, diverging: bool) -> Ty {
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/mir/eval.rs b/src/tools/rust-analyzer/crates/hir-ty/src/mir/eval.rs
index 45b43855681..be0a79f1dd3 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/mir/eval.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/mir/eval.rs
@@ -1119,7 +1119,7 @@ impl Evaluator<'_> {
                 "Stack overflow. Tried to grow stack to {stack_size} bytes"
             )));
         }
-        self.stack.extend(iter::repeat(0).take(stack_size));
+        self.stack.extend(std::iter::repeat_n(0, stack_size));
         Ok((locals, prev_stack_pointer))
     }
 
@@ -2122,7 +2122,7 @@ impl Evaluator<'_> {
             return Err(MirEvalError::Panic(format!("Memory allocation of {size} bytes failed")));
         }
         let pos = self.heap.len();
-        self.heap.extend(iter::repeat(0).take(size));
+        self.heap.extend(std::iter::repeat_n(0, size));
         Ok(Address::Heap(pos))
     }
 
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/mir/eval/shim/simd.rs b/src/tools/rust-analyzer/crates/hir-ty/src/mir/eval/shim/simd.rs
index 829ed9efa2b..54754045c98 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/mir/eval/shim/simd.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/mir/eval/shim/simd.rs
@@ -127,7 +127,7 @@ impl Evaluator<'_> {
                         Ordering::Greater => ["ge", "gt", "ne"].contains(&name),
                     };
                     let result = if result { 255 } else { 0 };
-                    destination_bytes.extend(std::iter::repeat(result).take(dest_size));
+                    destination_bytes.extend(std::iter::repeat_n(result, dest_size));
                 }
 
                 destination.write_from_bytes(self, &destination_bytes)
diff --git a/src/tools/rust-analyzer/crates/ide/src/signature_help.rs b/src/tools/rust-analyzer/crates/ide/src/signature_help.rs
index 84912f6be65..ce3c4238b5b 100644
--- a/src/tools/rust-analyzer/crates/ide/src/signature_help.rs
+++ b/src/tools/rust-analyzer/crates/ide/src/signature_help.rs
@@ -695,7 +695,7 @@ fn signature_help_for_tuple_pat_ish(
 }
 #[cfg(test)]
 mod tests {
-    use std::iter;
+    
 
     use expect_test::{expect, Expect};
     use ide_db::FilePosition;
@@ -742,11 +742,11 @@ mod tests {
                     let gap = start.checked_sub(offset).unwrap_or_else(|| {
                         panic!("parameter ranges out of order: {:?}", sig_help.parameter_ranges())
                     });
-                    rendered.extend(iter::repeat(' ').take(gap as usize));
+                    rendered.extend(std::iter::repeat_n(' ', gap as usize));
                     let param_text = &sig_help.signature[*range];
                     let width = param_text.chars().count(); // …
                     let marker = if is_active { '^' } else { '-' };
-                    rendered.extend(iter::repeat(marker).take(width));
+                    rendered.extend(std::iter::repeat_n(marker, width));
                     offset += gap + u32::from(range.len());
                 }
                 if !sig_help.parameter_ranges().is_empty() {
diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/lsp/to_proto.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/lsp/to_proto.rs
index 70e567ec769..d9fab85df1c 100644
--- a/src/tools/rust-analyzer/crates/rust-analyzer/src/lsp/to_proto.rs
+++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/lsp/to_proto.rs
@@ -1549,7 +1549,7 @@ pub(crate) fn runnable(
             );
 
             let cwd = match runnable.kind {
-                ide::RunnableKind::Bin { .. } => workspace_root.clone(),
+                ide::RunnableKind::Bin => workspace_root.clone(),
                 _ => spec.cargo_toml.parent().to_owned(),
             };