Unnamed repository; edit this file 'description' to name the repository.
-rw-r--r--crates/hir-def/src/item_tree/lower.rs2
-rw-r--r--crates/hir-ty/src/builder.rs6
-rw-r--r--crates/hir-ty/src/infer/unify.rs4
-rw-r--r--crates/hir-ty/src/mir/eval.rs4
-rw-r--r--crates/hir-ty/src/mir/eval/shim/simd.rs2
-rw-r--r--crates/ide/src/signature_help.rs6
-rw-r--r--crates/rust-analyzer/src/lsp/to_proto.rs2
7 files changed, 13 insertions, 13 deletions
diff --git a/crates/hir-def/src/item_tree/lower.rs b/crates/hir-def/src/item_tree/lower.rs
index b0cc7ead8c..3c85d5bacb 100644
--- a/crates/hir-def/src/item_tree/lower.rs
+++ b/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/crates/hir-ty/src/builder.rs b/crates/hir-ty/src/builder.rs
index 76d9c60f6f..4c35db0c9b 100644
--- a/crates/hir-ty/src/builder.rs
+++ b/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/crates/hir-ty/src/infer/unify.rs b/crates/hir-ty/src/infer/unify.rs
index e55fc0a9b8..6d80bfc38e 100644
--- a/crates/hir-ty/src/infer/unify.rs
+++ b/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/crates/hir-ty/src/mir/eval.rs b/crates/hir-ty/src/mir/eval.rs
index 45b4385568..be0a79f1dd 100644
--- a/crates/hir-ty/src/mir/eval.rs
+++ b/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/crates/hir-ty/src/mir/eval/shim/simd.rs b/crates/hir-ty/src/mir/eval/shim/simd.rs
index 829ed9efa2..54754045c9 100644
--- a/crates/hir-ty/src/mir/eval/shim/simd.rs
+++ b/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/crates/ide/src/signature_help.rs b/crates/ide/src/signature_help.rs
index 84912f6be6..ce3c4238b5 100644
--- a/crates/ide/src/signature_help.rs
+++ b/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/crates/rust-analyzer/src/lsp/to_proto.rs b/crates/rust-analyzer/src/lsp/to_proto.rs
index 70e567ec76..d9fab85df1 100644
--- a/crates/rust-analyzer/src/lsp/to_proto.rs
+++ b/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(),
};