From 5d37ba1990bdc552694383d2a3c6cbeb72b77f49 Mon Sep 17 00:00:00 2001 From: Matthias Krüger Date: Mon, 23 Apr 2018 13:04:37 +0200 Subject: mark std::str::replacen and std::str::replace as #[must_use]. --- src/liballoc/lib.rs | 1 + src/liballoc/str.rs | 2 ++ 2 files changed, 3 insertions(+) (limited to 'src/liballoc') diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index 6399be98cd5..021395d0c82 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -96,6 +96,7 @@ #![feature(dropck_eyepatch)] #![feature(exact_size_is_empty)] #![feature(fmt_internals)] +#![feature(fn_must_use)] #![feature(from_ref)] #![feature(fundamental)] #![feature(lang_items)] diff --git a/src/liballoc/str.rs b/src/liballoc/str.rs index 82ba2f45711..e8c6b964c70 100644 --- a/src/liballoc/str.rs +++ b/src/liballoc/str.rs @@ -207,6 +207,7 @@ impl str { /// let s = "this is old"; /// assert_eq!(s, s.replace("cookie monster", "little lamb")); /// ``` + #[must_use] #[stable(feature = "rust1", since = "1.0.0")] #[inline] pub fn replace<'a, P: Pattern<'a>>(&'a self, from: P, to: &str) -> String { @@ -246,6 +247,7 @@ impl str { /// let s = "this is old"; /// assert_eq!(s, s.replacen("cookie monster", "little lamb", 10)); /// ``` + #[must_use] #[stable(feature = "str_replacen", since = "1.16.0")] pub fn replacen<'a, P: Pattern<'a>>(&'a self, pat: P, to: &str, count: usize) -> String { // Hope to reduce the times of re-allocation -- cgit 1.4.1-3-g733a5 From 1bcb267651c2f4a840e928d9309c240d146a335b Mon Sep 17 00:00:00 2001 From: Ralf Biedert Date: Wed, 25 Apr 2018 14:14:43 +0200 Subject: Added missing `.` in docs. --- src/liballoc/arc.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/liballoc') diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs index f5980f4599e..e52a0216dd3 100644 --- a/src/liballoc/arc.rs +++ b/src/liballoc/arc.rs @@ -60,7 +60,7 @@ const MAX_REFCOUNT: usize = (isize::MAX) as usize; /// ## Thread Safety /// /// Unlike [`Rc`], `Arc` uses atomic operations for its reference -/// counting This means that it is thread-safe. The disadvantage is that +/// counting. This means that it is thread-safe. The disadvantage is that /// atomic operations are more expensive than ordinary memory accesses. If you /// are not sharing reference-counted values between threads, consider using /// [`Rc`] for lower overhead. [`Rc`] is a safe default, because the -- cgit 1.4.1-3-g733a5