diff options
| author | John Kugelman <john@kugelman.name> | 2021-10-11 16:15:50 -0400 |
|---|---|---|
| committer | John Kugelman <john@kugelman.name> | 2021-10-30 19:25:12 -0400 |
| commit | 6745e8da06e1fd313d2ff20ff9fe8d8dc4714479 (patch) | |
| tree | 3e95126f0f29319c6c2ce80aef7fc275c1c33897 /library/alloc/src/string.rs | |
| parent | 86d6d2b7389fe1b339402c1798edae8b695fc9ef (diff) | |
| download | rust-6745e8da06e1fd313d2ff20ff9fe8d8dc4714479.tar.gz rust-6745e8da06e1fd313d2ff20ff9fe8d8dc4714479.zip | |
Add #[must_use] to len and is_empty
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 d00792b9c3e..651e55cc094 100644 --- a/library/alloc/src/string.rs +++ b/library/alloc/src/string.rs @@ -1537,6 +1537,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() @@ -1556,6 +1557,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 |
