diff options
| author | Scott McMurray <scottmcm@users.noreply.github.com> | 2018-03-30 23:06:05 -0700 |
|---|---|---|
| committer | Scott McMurray <scottmcm@users.noreply.github.com> | 2018-03-30 23:06:05 -0700 |
| commit | fb7deda27419eae61da3cbf5a5b1b4f51ae16d04 (patch) | |
| tree | 9dc51de2af727ff8741edb1c3f2b1665374da21d /src/liballoc | |
| parent | 80785a547d29519dbdb5781437ec318fb210b980 (diff) | |
| download | rust-fb7deda27419eae61da3cbf5a5b1b4f51ae16d04.tar.gz rust-fb7deda27419eae61da3cbf5a5b1b4f51ae16d04.zip | |
Add #[must_use] to a few standard library methods
Chosen to start a precedent of using it on ones that are potentially-expensive and where using it for side effects is particularly discouraged. Discuss :)
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/borrow.rs | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/liballoc/borrow.rs b/src/liballoc/borrow.rs index acae0daa86b..c6741ddb822 100644 --- a/src/liballoc/borrow.rs +++ b/src/liballoc/borrow.rs @@ -59,6 +59,7 @@ pub trait ToOwned { /// let vv: Vec<i32> = v.to_owned(); /// ``` #[stable(feature = "rust1", since = "1.0.0")] + #[must_use = "cloning is often expensive and is not expected to have side effects"] fn to_owned(&self) -> Self::Owned; /// Uses borrowed data to replace owned data, usually by cloning. |
