diff options
| author | lapla-cogito <me@lapla.dev> | 2024-12-21 01:17:50 +0900 |
|---|---|---|
| committer | lapla-cogito <me@lapla.dev> | 2025-01-15 13:15:41 +0900 |
| commit | 9a1bbe91bc0fd18235ba8e243fc121ab8270febd (patch) | |
| tree | 74cbf03763619c97aaeb576fa7e1a7b503ae31e7 | |
| parent | 544f71f48d0b73db7d5815519dc6fd6a4ce87390 (diff) | |
| download | rust-9a1bbe91bc0fd18235ba8e243fc121ab8270febd.tar.gz rust-9a1bbe91bc0fd18235ba8e243fc121ab8270febd.zip | |
use `repeat_n()` where available
| -rw-r--r-- | clippy_lints/src/doc/lazy_continuation.rs | 2 | ||||
| -rw-r--r-- | clippy_utils/src/lib.rs | 5 |
2 files changed, 3 insertions, 4 deletions
diff --git a/clippy_lints/src/doc/lazy_continuation.rs b/clippy_lints/src/doc/lazy_continuation.rs index f9e4a43c0e7..d6ab9ac6749 100644 --- a/clippy_lints/src/doc/lazy_continuation.rs +++ b/clippy_lints/src/doc/lazy_continuation.rs @@ -57,7 +57,7 @@ pub(super) fn check( diag.span_suggestion_verbose( span.shrink_to_hi(), "indent this line", - std::iter::repeat(" ").take(indent).join(""), + std::iter::repeat_n(" ", indent).join(""), Applicability::MaybeIncorrect, ); diag.help("if this is supposed to be its own paragraph, add a blank line"); diff --git a/clippy_utils/src/lib.rs b/clippy_utils/src/lib.rs index 676f387a7f0..25c55aade15 100644 --- a/clippy_utils/src/lib.rs +++ b/clippy_utils/src/lib.rs @@ -15,7 +15,6 @@ clippy::missing_errors_doc, clippy::missing_panics_doc, clippy::must_use_candidate, - clippy::manual_repeat_n, rustc::diagnostic_outside_of_impl, rustc::untranslatable_diagnostic )] @@ -89,7 +88,7 @@ use core::mem; use core::ops::ControlFlow; use std::collections::hash_map::Entry; use std::hash::BuildHasherDefault; -use std::iter::{once, repeat}; +use std::iter::{once, repeat_n}; use std::sync::{Mutex, MutexGuard, OnceLock}; use itertools::Itertools; @@ -3421,7 +3420,7 @@ fn maybe_get_relative_path(from: &DefPath, to: &DefPath, max_super: usize) -> St })) .join("::") } else { - repeat(String::from("super")).take(go_up_by).chain(path).join("::") + repeat_n(String::from("super"), go_up_by).chain(path).join("::") } } |
