Skip to content

rust/clippy: disable redundant_clone #508

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

Merged
merged 2 commits into from
Jun 21, 2020
Merged

Conversation

benma
Copy link
Collaborator

@benma benma commented Jun 19, 2020

Has false positives that can be very subtle, so best to play it
safe.

async-rs/async-task#23

Has false positives that can be very subtle, so best to play it
safe.

async-rs/async-task#23
@benma benma requested a review from x1ddos June 19, 2020 10:19
@@ -207,7 +207,7 @@ pub extern "C" fn bitboxbase_state_set_not_alive() {
#[no_mangle]
pub extern "C" fn bitboxbase_state_get() -> BitBoxBaseBackgroundState {
let state = unsafe { &STATE };
state.state.clone()
state.state
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NickeZ clippy warned this

https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy

Sounds legit, do you remember why there was a clone() here?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, can't remember. Usually I add clone()s as temporary fixes to make the borrowchecker happy. Having many clones is a bit of a code smell.

@x1ddos
Copy link
Contributor

x1ddos commented Jun 19, 2020

Hm... I'm quite disappointed with clippy at this point. It's always best to leave uncertain things as is and avoid false positives.

@benma
Copy link
Collaborator Author

benma commented Jun 19, 2020

Hm... I'm quite disappointed with clippy at this point. It's always best to leave uncertain things as is and avoid false positives.

agree, at least the default linters should be 100% false positive free, when it comes to semantics.

Copy link
Contributor

@x1ddos x1ddos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@benma benma merged commit b888d26 into BitBoxSwiss:master Jun 21, 2020
@benma benma deleted the clippy branch June 21, 2020 22:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants