about summary refs log tree commit diff
path: root/library/core/src/array
diff options
context:
space:
mode:
authorStuart Cook <Zalathar@users.noreply.github.com>2025-09-04 10:01:58 +1000
committerGitHub <noreply@github.com>2025-09-04 10:01:58 +1000
commitc7a11f42e0a6c07f68009c183878f6aaf1bc14ed (patch)
tree3452c9809c8ad76093e86c4da94128a248d17c18 /library/core/src/array
parent2952b99dcafa1ca6b63641d67f1a371e61e8faee (diff)
parenta44b180178b5d7787291df29f18d2495c0cad35b (diff)
Rollup merge of #146054 - joboet:array-repeat-must_use, r=ibraheemdev
add `#[must_use]` to `array::repeat`
Diffstat (limited to 'library/core/src/array')
-rw-r--r--library/core/src/array/mod.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/library/core/src/array/mod.rs b/library/core/src/array/mod.rs
index 4cdc046f71e..d14419a23a1 100644
--- a/library/core/src/array/mod.rs
+++ b/library/core/src/array/mod.rs
@@ -48,6 +48,7 @@ pub use iter::IntoIter;
 /// assert_eq!(strings, ["Hello there!", "Hello there!"]);
 /// ```
 #[inline]
+#[must_use = "cloning is often expensive and is not expected to have side effects"]
 #[stable(feature = "array_repeat", since = "CURRENT_RUSTC_VERSION")]
 pub fn repeat<T: Clone, const N: usize>(val: T) -> [T; N] {
     from_trusted_iterator(repeat_n(val, N))