Unnamed repository; edit this file 'description' to name the repository.
Add must_use to StrExt methods
Alex Butler 2024-02-09
parent 79bb5e3 · commit da4eb11
-rw-r--r--lib/smol_str/src/lib.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/smol_str/src/lib.rs b/lib/smol_str/src/lib.rs
index 79a22b6021..192f972353 100644
--- a/lib/smol_str/src/lib.rs
+++ b/lib/smol_str/src/lib.rs
@@ -551,24 +551,28 @@ pub trait StrExt: private::Sealed {
/// potentially without allocating.
///
/// See [`str::to_lowercase`].
+ #[must_use = "this returns a new SmolStr without modifying the original"]
fn to_lowercase_smolstr(&self) -> SmolStr;
/// Returns the uppercase equivalent of this string slice as a new [`SmolStr`],
/// potentially without allocating.
///
/// See [`str::to_uppercase`].
+ #[must_use = "this returns a new SmolStr without modifying the original"]
fn to_uppercase_smolstr(&self) -> SmolStr;
/// Returns the ASCII lowercase equivalent of this string slice as a new [`SmolStr`],
/// potentially without allocating.
///
/// See [`str::to_ascii_lowercase`].
+ #[must_use = "this returns a new SmolStr without modifying the original"]
fn to_ascii_lowercase_smolstr(&self) -> SmolStr;
/// Returns the ASCII uppercase equivalent of this string slice as a new [`SmolStr`],
/// potentially without allocating.
///
/// See [`str::to_ascii_uppercase`].
+ #[must_use = "this returns a new SmolStr without modifying the original"]
fn to_ascii_uppercase_smolstr(&self) -> SmolStr;
}