about summary refs log tree commit diff
path: root/library/alloc/src/string.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-10-12 17:57:34 +0000
committerbors <bors@rust-lang.org>2021-10-12 17:57:34 +0000
commit044674337a180c494b7e6fdce4b20dca93324b2a (patch)
tree8f331316d06a859e5737eeabb2e7ef23e0ce0c36 /library/alloc/src/string.rs
parent9475e609b8458fff9e444934a6017d2e590642cf (diff)
parent6cdf8030f0f344cf28e350785c77669b777251db (diff)
Auto merge of #89813 - the8472:rollup-f1f99mb, r=the8472
Rollup of 7 pull requests

Successful merges:

 - #89778 (Add #[must_use] to as_type conversions)
 - #89784 (Remove built-in query cache_hit tracking)
 - #89796 (Add #[must_use] to non-mutating verb methods)
 - #89797 (Add #[must_use] to is_condition tests)
 - #89799 (fix minor spelling error in Poll::ready docs)
 - #89800 (Update books)
 - #89809 (Remap ssa RealPredicate to llvm RealPredicate)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'library/alloc/src/string.rs')
-rw-r--r--library/alloc/src/string.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/library/alloc/src/string.rs b/library/alloc/src/string.rs
index f11fa92766f..f479bf231b3 100644
--- a/library/alloc/src/string.rs
+++ b/library/alloc/src/string.rs
@@ -803,6 +803,7 @@ impl String {
     /// assert_eq!("foo", s.as_str());
     /// ```
     #[inline]
+    #[must_use]
     #[stable(feature = "string_as_str", since = "1.7.0")]
     pub fn as_str(&self) -> &str {
         self
@@ -823,6 +824,7 @@ impl String {
     /// assert_eq!("FOOBAR", s_mut_str);
     /// ```
     #[inline]
+    #[must_use]
     #[stable(feature = "string_as_str", since = "1.7.0")]
     pub fn as_mut_str(&mut self) -> &mut str {
         self
@@ -1163,6 +1165,7 @@ impl String {
     /// assert_eq!(&[104, 101, 108, 108, 111], s.as_bytes());
     /// ```
     #[inline]
+    #[must_use]
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn as_bytes(&self) -> &[u8] {
         &self.vec
@@ -1766,6 +1769,7 @@ impl FromUtf8Error {
     ///
     /// assert_eq!(&[0, 159], value.unwrap_err().as_bytes());
     /// ```
+    #[must_use]
     #[stable(feature = "from_utf8_error_as_bytes", since = "1.26.0")]
     pub fn as_bytes(&self) -> &[u8] {
         &self.bytes[..]
@@ -2782,6 +2786,7 @@ impl<'a> Drain<'a> {
     /// let _ = drain.next().unwrap();
     /// assert_eq!(drain.as_str(), "bc");
     /// ```
+    #[must_use]
     #[stable(feature = "string_drain_as_str", since = "1.55.0")]
     pub fn as_str(&self) -> &str {
         self.iter.as_str()