about summary refs log tree commit diff
path: root/library/std/src
diff options
context:
space:
mode:
authorthe8472 <the8472@users.noreply.github.com>2021-10-12 14:53:10 +0200
committerGitHub <noreply@github.com>2021-10-12 14:53:10 +0200
commita1bdd48106cdb3f9888a564aaa6aa0daef843d64 (patch)
tree14619a3abc63f02560b824c03ec68f466cc78bd6 /library/std/src
parent4ce1ce1f7672c52ce32cd429bb21a12653e2b605 (diff)
parentc3f0577002b5c158c63dab92476d94af954086f1 (diff)
downloadrust-a1bdd48106cdb3f9888a564aaa6aa0daef843d64.tar.gz
rust-a1bdd48106cdb3f9888a564aaa6aa0daef843d64.zip
Rollup merge of #89796 - jkugelman:must-use-non-mutating-verb-methods, r=joshtriplett
Add #[must_use] to non-mutating verb methods

These are methods that could be misconstrued to mutate their input, similar to #89694. I gave each one a different custom message.

I wrote that `upgrade` and `downgrade` don't modify the input pointers. Logically they don't, but technically they do...

Parent issue: #89692

r? ```@joshtriplett```
Diffstat (limited to 'library/std/src')
-rw-r--r--library/std/src/path.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/library/std/src/path.rs b/library/std/src/path.rs
index d9f18db2fa7..42c6b911849 100644
--- a/library/std/src/path.rs
+++ b/library/std/src/path.rs
@@ -2516,6 +2516,8 @@ impl Path {
     /// println!("{}", path.display());
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
+    #[must_use = "this does not display the path, \
+                  it returns an object that can be displayed"]
     #[inline]
     pub fn display(&self) -> Display<'_> {
         Display { path: self }