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

clippy: runtime lints #34630

Merged
merged 1 commit into from
Jan 3, 2024
Merged

Commits on Jan 3, 2024

  1. clippy: runtime lints

    ```
    warning: in a `match` scrutinee, avoid complex blocks or closures with blocks; instead, move the block or closure higher and bind it with a `let`
       --> runtime/src/accounts/mod.rs:483:82
        |
    483 |       let min_balance = match get_system_account_kind(payer_account).ok_or_else(|| {
        |  __________________________________________________________________________________^
    484 | |         error_counters.invalid_account_for_fee += 1;
    485 | |         TransactionError::InvalidAccountForFee
    486 | |     })? {
        | |_____^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#blocks_in_conditions
        = note: `#[warn(clippy::blocks_in_conditions)]` on by default
    
    warning: this `let...else` may be rewritten with the `?` operator
        --> runtime/src/bank.rs:3093:21
         |
    3093 | /                     let Some(vote_account) = get_vote_account(&vote_pubkey) else {
    3094 | |                         return None;
    3095 | |                     };
         | |______________________^ help: replace it with: `let vote_account = get_vote_account(&vote_pubkey)?;`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#question_mark
         = note: `#[warn(clippy::question_mark)]` on by default
    
    warning: this `let...else` may be rewritten with the `?` operator
        --> runtime/src/bank.rs:4778:17
         |
    4778 | /                 let Some((_, account)) = accounts.get(i) else {
    4779 | |                     return None;
    4780 | |                 };
         | |__________________^ help: replace it with: `let (_, account) = accounts.get(i)?;`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#question_mark
    
        Checking solana-bench-streamer v1.18.0 (/Users/brooks/src/solana/bench-streamer)
    warning: `solana-runtime` (lib) generated 3 warnings
    ```
    brooksprumo committed Jan 3, 2024
    Configuration menu
    Copy the full SHA
    523d122 View commit details
    Browse the repository at this point in the history