summaryrefslogtreecommitdiff
path: root/crates/typst-library/src
diff options
context:
space:
mode:
authorevie <50974538+mi2ebi@users.noreply.github.com>2025-03-11 03:00:53 -0700
committerGitHub <noreply@github.com>2025-03-11 10:00:53 +0000
commit3650859ae8823f47c9f50db6ad5ed52a0477bf15 (patch)
treeccb21d73c0263019744ea5e8276fbda91ee4f7f5 /crates/typst-library/src
parentbd531e08dc3dbe26ac779d5730bf0814800b7de9 (diff)
Fix `cargo clippy` warnings (mostly about `.repeat.take` and `.next_back`) (#6038)
Diffstat (limited to 'crates/typst-library/src')
-rw-r--r--crates/typst-library/src/foundations/cast.rs2
-rw-r--r--crates/typst-library/src/model/numbering.rs2
-rw-r--r--crates/typst-library/src/visualize/gradient.rs3
3 files changed, 3 insertions, 4 deletions
diff --git a/crates/typst-library/src/foundations/cast.rs b/crates/typst-library/src/foundations/cast.rs
index 38f409c6..73645491 100644
--- a/crates/typst-library/src/foundations/cast.rs
+++ b/crates/typst-library/src/foundations/cast.rs
@@ -21,7 +21,7 @@ use crate::foundations::{
///
/// Type casting works as follows:
/// - [`Reflect for T`](Reflect) describes the possible Typst values for `T`
-/// (for documentation and autocomplete).
+/// (for documentation and autocomplete).
/// - [`IntoValue for T`](IntoValue) is for conversion from `T -> Value`
/// (infallible)
/// - [`FromValue for T`](FromValue) is for conversion from `Value -> T`
diff --git a/crates/typst-library/src/model/numbering.rs b/crates/typst-library/src/model/numbering.rs
index 15050675..ada8a396 100644
--- a/crates/typst-library/src/model/numbering.rs
+++ b/crates/typst-library/src/model/numbering.rs
@@ -394,7 +394,7 @@ impl NumberingKind {
const SYMBOLS: &[char] = &['*', '†', '‡', '§', '¶', '‖'];
let symbol = SYMBOLS[(n - 1) % SYMBOLS.len()];
let amount = ((n - 1) / SYMBOLS.len()) + 1;
- std::iter::repeat(symbol).take(amount).collect()
+ std::iter::repeat_n(symbol, amount).collect()
}
Self::Hebrew => hebrew_numeral(n),
diff --git a/crates/typst-library/src/visualize/gradient.rs b/crates/typst-library/src/visualize/gradient.rs
index 1a723a9f..d59175a4 100644
--- a/crates/typst-library/src/visualize/gradient.rs
+++ b/crates/typst-library/src/visualize/gradient.rs
@@ -574,8 +574,7 @@ impl Gradient {
}
let n = repetitions.v;
- let mut stops = std::iter::repeat(self.stops_ref())
- .take(n)
+ let mut stops = std::iter::repeat_n(self.stops_ref(), n)
.enumerate()
.flat_map(|(i, stops)| {
let mut stops = stops