diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2021-10-31 13:20:05 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-31 13:20:05 +0100 |
| commit | 88e5ae2dd3cf4a0bbb5af69ef70e80d5dc7b462c (patch) | |
| tree | 2b75ed54b12905fbfd24ed552d20956ded93847f /library/alloc/src/string.rs | |
| parent | 6c5aa765fb64758825fae0371b54ef07c3589e7a (diff) | |
| parent | 6745e8da06e1fd313d2ff20ff9fe8d8dc4714479 (diff) | |
| download | rust-88e5ae2dd3cf4a0bbb5af69ef70e80d5dc7b462c.tar.gz rust-88e5ae2dd3cf4a0bbb5af69ef70e80d5dc7b462c.zip | |
Rollup merge of #89786 - jkugelman:must-use-len-and-is_empty, r=joshtriplett
Add #[must_use] to len and is_empty Parent issue: #89692 r? `@joshtriplett`
Diffstat (limited to 'library/alloc/src/string.rs')
| -rw-r--r-- | library/alloc/src/string.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/library/alloc/src/string.rs b/library/alloc/src/string.rs index 677942a1820..906b0187f7b 100644 --- a/library/alloc/src/string.rs +++ b/library/alloc/src/string.rs @@ -1547,6 +1547,7 @@ impl String { /// assert_eq!(fancy_f.chars().count(), 3); /// ``` #[inline] + #[must_use] #[stable(feature = "rust1", since = "1.0.0")] pub fn len(&self) -> usize { self.vec.len() @@ -1566,6 +1567,7 @@ impl String { /// assert!(!v.is_empty()); /// ``` #[inline] + #[must_use] #[stable(feature = "rust1", since = "1.0.0")] pub fn is_empty(&self) -> bool { self.len() == 0 |
