about summary refs log tree commit diff
diff options
context:
space:
mode:
authorjoboet <jonasboettiger@icloud.com>2025-08-31 13:52:06 +0200
committerjoboet <jonasboettiger@icloud.com>2025-08-31 13:52:06 +0200
commita44b180178b5d7787291df29f18d2495c0cad35b (patch)
tree86972a736f1cb2e961777fd66fc8bea89a6651b5
parent64a99db105f45ea3304732ffb51066c3b5193bc7 (diff)
downloadrust-a44b180178b5d7787291df29f18d2495c0cad35b.tar.gz
rust-a44b180178b5d7787291df29f18d2495c0cad35b.zip
add `#[must_use]` to `array::repeat`
-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 c4bb5ab7b21..452ec95266f 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))