-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use mem::take
instead of mem::replace
when applicable
#4881
Use mem::take
instead of mem::replace
when applicable
#4881
Conversation
mem::take
instead of mem::replace
when applicablemem::take
instead of mem::replace
when applicable
401b3d1
to
64855de
Compare
mem::take
instead of mem::replace
when applicablemem::take
instead of mem::replace
when applicable
0f6b46c
to
38bb08d
Compare
@lzutao Hey I added checks so that it doesn't lint within macros. Also added some macro test cases to prevent regressions in the future. |
8a27af3
to
5c225e1
Compare
☔ The latest upstream changes (presumably #4932) made this pull request unmergeable. Please resolve the merge conflicts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Linting in internal macros would be good though. On how to test this see my comment #4881 (comment)
And sorry for the late reply, I was on vacation. |
5c225e1
to
38e7bd2
Compare
If you change - if func_args.len() == 2;
+ if let [dest, src] = &**func_args; |
This comment has been minimized.
This comment has been minimized.
8d1f0fc
to
5d8366f
Compare
@bors r+ Thanks! |
📌 Commit aca6815 has been approved by |
…lip1995 Use `mem::take` instead of `mem::replace` when applicable `std::mem::take` can be used to replace a value of type `T` with `T::default()` instead of `std::mem::replace`. Fixes issue #4871 changelog: Added lint for [`mem_replace_with_default`]
💔 Test failed - checks-travis |
|
aca6815
to
36cea1c
Compare
@bors retry |
@krishna-veerareddy: 🔑 Insufficient privileges: not in try users |
@flip1995 Hey I added the rustup fixes. Please review. |
36cea1c
to
45e7b87
Compare
@bors r+ Thanks! |
📌 Commit 45e7b87 has been approved by |
…lip1995 Use `mem::take` instead of `mem::replace` when applicable `std::mem::take` can be used to replace a value of type `T` with `T::default()` instead of `std::mem::replace`. Fixes issue #4871 changelog: Added lint for [`mem_replace_with_default`]
💔 Test failed - status-appveyor |
45e7b87
to
f1e22c8
Compare
`std::mem::take` can be used to replace a value of type `T` with `T::default()` instead of `std::mem::replace`.
Also added test cases for internal and external macros.
f1e22c8
to
42e4595
Compare
@bors r=flip1995 |
📌 Commit 42e4595 has been approved by |
…lip1995 Use `mem::take` instead of `mem::replace` when applicable `std::mem::take` can be used to replace a value of type `T` with `T::default()` instead of `std::mem::replace`. Fixes issue #4871 changelog: Added lint for [`mem_replace_with_default`]
☀️ Test successful - checks-travis, status-appveyor |
std::mem::take
can be used to replace a value of typeT
withT::default()
instead ofstd::mem::replace
.Fixes issue #4871
changelog: Added lint for [
mem_replace_with_default
]