Skip to content

Commit c7a11f4

Browse files
authored
Rollup merge of #146054 - joboet:array-repeat-must_use, r=ibraheemdev
add `#[must_use]` to `array::repeat`
2 parents 2952b99 + a44b180 commit c7a11f4

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

library/core/src/array/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ pub use iter::IntoIter;
4848
/// assert_eq!(strings, ["Hello there!", "Hello there!"]);
4949
/// ```
5050
#[inline]
51+
#[must_use = "cloning is often expensive and is not expected to have side effects"]
5152
#[stable(feature = "array_repeat", since = "CURRENT_RUSTC_VERSION")]
5253
pub fn repeat<T: Clone, const N: usize>(val: T) -> [T; N] {
5354
from_trusted_iterator(repeat_n(val, N))

0 commit comments

Comments
 (0)