From fec95147276171601cd6c14b490460370a590c85 Mon Sep 17 00:00:00 2001 From: John Kugelman Date: Sat, 9 Oct 2021 21:35:09 -0400 Subject: [PATCH] Add #[must_use] to char escape methods --- library/core/src/char/methods.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/library/core/src/char/methods.rs b/library/core/src/char/methods.rs index b3af1f1ffb5..eb13e1f42bd 100644 --- a/library/core/src/char/methods.rs +++ b/library/core/src/char/methods.rs @@ -377,6 +377,8 @@ impl char { /// ``` /// assert_eq!('❤'.escape_unicode().to_string(), "\\u{2764}"); /// ``` + #[must_use = "this returns the escaped char as an iterator, \ + without modifying the original"] #[stable(feature = "rust1", since = "1.0.0")] #[inline] pub fn escape_unicode(self) -> EscapeUnicode { @@ -453,6 +455,8 @@ impl char { /// ``` /// assert_eq!('\n'.escape_debug().to_string(), "\\n"); /// ``` + #[must_use = "this returns the escaped char as an iterator, \ + without modifying the original"] #[stable(feature = "char_escape_debug", since = "1.20.0")] #[inline] pub fn escape_debug(self) -> EscapeDebug { @@ -507,6 +511,8 @@ impl char { /// ``` /// assert_eq!('"'.escape_default().to_string(), "\\\""); /// ``` + #[must_use = "this returns the escaped char as an iterator, \ + without modifying the original"] #[stable(feature = "rust1", since = "1.0.0")] #[inline] pub fn escape_default(self) -> EscapeDefault {