Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2141b24

Browse files
authored
Rollup merge of rust-lang#146054 - joboet:array-repeat-must_use, r=ibraheemdev
add `#[must_use]` to `array::repeat`
2 parents 7cf7543 + a44b180 commit 2141b24

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)

AltStyle によって変換されたページ (->オリジナル) /