Uh oh!
There was an error while loading. Please reload this page.
Lint must_use on mem::replace - #71256
Conversation
This adds a hint on `mem::replace`, "if you don't need the old value, you can just assign the new value directly". This is in similar spirit to the `must_use` on `ManuallyDrop::take`.
rust-highfive
commented
Apr 17, 2020
r? @kennytm (rust_highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
cuviper
commented
Apr 17, 2020
Huh, I didn't expect that this would already affect code in the compiler itself. I'll look into it. |
cuviper
commented
Apr 17, 2020
OK, github-actions CI/PR passed now. |
Uh oh!
There was an error while loading. Please reload this page.
estebank
commented
Apr 19, 2020
I'm ok with the code changes. Couldn't find whether the lint is only warn-by-default. If it is, then r=me, after the nitpick about the test. |
cuviper
commented
Apr 20, 2020
Yes, it is a warning by default -- the way that I check is with I addressed the test nitpick too, so... @bors r=estebank |
bors
commented
Apr 20, 2020
📌 Commit 7fca9f8 has been approved by |
Lint must_use on mem::replace This adds a hint on `mem::replace`, "if you don't need the old value, you can just assign the new value directly". This is in similar spirit to the `must_use` on `ManuallyDrop::take`.
Dylan-DPC-zz
commented
Apr 20, 2020
fails since cargo doesn't use the result somewhere, (fixing it) |
Dylan-DPC-zz
commented
Apr 20, 2020
@bors r- |
fix mem replace unused `mem::replace` will be linted as must_use, so modifying this. This is currently blocking rust-lang/rust#71256
cuviper
commented
Apr 20, 2020
I see, cargo already had a warning in the normal build, but |
Dylan-DPC-zz
commented
Apr 20, 2020
the blocking pr is now merged @bors r=estebank |
bors
commented
Apr 20, 2020
📌 Commit 7fca9f8 has been approved by |
cuviper
commented
Apr 20, 2020
Do I need to update the cargo submodule too? Or are you handling that elsewhere? |
Dylan-DPC-zz
commented
Apr 20, 2020
Uh right we probably have to update cargo first |
Dylan-DPC-zz
commented
Apr 20, 2020
@bors r- |
ehuss
commented
Apr 20, 2020
I'll post a cargo update tomorrowish after the beta branch. There are several big changes that I don't feel comfortable sliding into beta at the last moment. |
cuviper
commented
Apr 22, 2020
bors
commented
Apr 22, 2020
📌 Commit 7fca9f8 has been approved by |
Rollup of 5 pull requests Successful merges: - rust-lang#71256 (Lint must_use on mem::replace) - rust-lang#71350 (Error code explanation extra check) - rust-lang#71369 (allow wasm32 compilation of librustc_data_structures/profiling.rs) - rust-lang#71400 (proc_macro::is_available()) - rust-lang#71440 (Implement `Copy` for `AllocErr`) Failed merges: r? @ghost
This adds a hint on
mem::replace, "if you don't need the old value,you can just assign the new value directly". This is in similar spirit
to the
must_useonManuallyDrop::take.