Rollup merge of #89719 - jkugelman:must-use-char-escape-methods, r=joshtriplett

Add #[must_use] to char escape methods

Parent issue: #89692
This commit is contained in:
Matthias Krüger 2021-10-10 18:22:24 +02:00 committed by GitHub
commit 758a901a40
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 {