Skip to content

Commit

Permalink
Rollup merge of rust-lang#89719 - jkugelman:must-use-char-escape-meth…
Browse files Browse the repository at this point in the history
…ods, r=joshtriplett

Add #[must_use] to char escape methods

Parent issue: rust-lang#89692
  • Loading branch information
matthiaskrgr committed Oct 10, 2021
2 parents 0c04b1f + fec9514 commit 758a901
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions library/core/src/char/methods.rs
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 758a901

Please sign in to comment.