Skip to content

Commit 13b1011

Browse files
authored
Rollup merge of rust-lang#89719 - jkugelman:must-use-char-escape-methods, r=joshtriplett
Add #[must_use] to char escape methods Parent issue: rust-lang#89692
2 parents 15ee6d4 + fec9514 commit 13b1011

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

library/core/src/char/methods.rs

+6
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,8 @@ impl char {
377377
/// ```
378378
/// assert_eq!('❤'.escape_unicode().to_string(), "\\u{2764}");
379379
/// ```
380+
#[must_use = "this returns the escaped char as an iterator, \
381+
without modifying the original"]
380382
#[stable(feature = "rust1", since = "1.0.0")]
381383
#[inline]
382384
pub fn escape_unicode(self) -> EscapeUnicode {
@@ -453,6 +455,8 @@ impl char {
453455
/// ```
454456
/// assert_eq!('\n'.escape_debug().to_string(), "\\n");
455457
/// ```
458+
#[must_use = "this returns the escaped char as an iterator, \
459+
without modifying the original"]
456460
#[stable(feature = "char_escape_debug", since = "1.20.0")]
457461
#[inline]
458462
pub fn escape_debug(self) -> EscapeDebug {
@@ -507,6 +511,8 @@ impl char {
507511
/// ```
508512
/// assert_eq!('"'.escape_default().to_string(), "\\\"");
509513
/// ```
514+
#[must_use = "this returns the escaped char as an iterator, \
515+
without modifying the original"]
510516
#[stable(feature = "rust1", since = "1.0.0")]
511517
#[inline]
512518
pub fn escape_default(self) -> EscapeDefault {

0 commit comments

Comments
 (0)