Skip to content
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

cli: Remove allowing false positive clippy::needless_borrows_for_generic_args #3347

Conversation

acheroncrypto
Copy link
Collaborator

Problem

Rust 1.80 had a false positive lint for needless_borrows_for_generic_args:

warning: the borrowed expression implements the required traits
   --> cli/src/config.rs:892:69
    |
892 |                     *ledger_dir = canonicalize_filepath_from_origin(&ledger_dir, &path)?;
    |                                                                     ^^^^^^^^^^^ help: change this to: `ledger_dir`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
    = note: `#[warn(clippy::needless_borrows_for_generic_args)]` on by default

because applying the suggestion resulted in:

error[E0382]: use of moved value: `ledger_dir`
   --> cli/src/config.rs:892:21
    |
891 |                 if let Some(ledger_dir) = &mut validator.ledger {
    |                             ---------- move occurs because `ledger_dir` has type `&mut std::string::String`, which does not implement the `Copy` trait
892 |                     *ledger_dir = canonicalize_filepath_from_origin(ledger_dir, &path)?;
    |                     ^^^^^^^^^^^ value used here after move          ---------- value moved here
    |

so in #3145, we disabled the lint for clippy::needless_borrows_for_generic_args:

anchor/cli/src/config.rs

Lines 867 to 868 in 6147beb

// TODO: Remove if/when false positive gets fixed
#[allow(clippy::needless_borrows_for_generic_args)]

We can now remove this check because the problem has been fixed in rust-lang/rust-clippy#12892.

Summary of changes

Remove #[allow(clippy::needless_borrows_for_generic_args)] since it's no longer necessary.

Copy link

vercel bot commented Nov 5, 2024

@acheroncrypto is attempting to deploy a commit to the coral-xyz Team on Vercel.

A member of the Team first needs to authorize it.

@acheroncrypto acheroncrypto added cli fix Bug fix PR labels Nov 5, 2024
@acheroncrypto acheroncrypto merged commit eee03bc into coral-xyz:master Nov 6, 2024
49 of 50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli fix Bug fix PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant