From 98396c0aeffb4745ab08fb9f45e0d31ad0bd1402 Mon Sep 17 00:00:00 2001 From: acheron <98934430+acheroncrypto@users.noreply.github.com> Date: Fri, 2 Aug 2024 23:31:40 +0200 Subject: [PATCH] Fix clippy 1.80.0 lints (#3145) --- cli/src/config.rs | 2 ++ cli/src/lib.rs | 4 +--- lang/src/accounts/account.rs | 1 + lang/src/accounts/account_loader.rs | 2 +- lang/src/accounts/interface.rs | 6 +++--- lang/src/accounts/interface_account.rs | 1 + lang/src/accounts/program.rs | 6 +++--- lang/src/lib.rs | 4 ++-- 8 files changed, 14 insertions(+), 12 deletions(-) diff --git a/cli/src/config.rs b/cli/src/config.rs index 7500efa3cb..1b5ee602d9 100644 --- a/cli/src/config.rs +++ b/cli/src/config.rs @@ -832,6 +832,8 @@ pub struct _TestToml { } impl _TestToml { + // TODO: Remove if/when false positive gets fixed + #[allow(clippy::needless_borrows_for_generic_args)] fn from_path(path: impl AsRef) -> Result { let s = fs::read_to_string(&path)?; let parsed_toml: Self = toml::from_str(&s)?; diff --git a/cli/src/lib.rs b/cli/src/lib.rs index 09a695967e..842c75d132 100644 --- a/cli/src/lib.rs +++ b/cli/src/lib.rs @@ -1,5 +1,3 @@ -#![cfg_attr(nightly, feature(proc_macro_span))] - use crate::config::{ AnchorPackage, BootstrapMode, BuildConfig, Config, ConfigOverride, Manifest, ProgramArch, ProgramDeployment, ProgramWorkspace, ScriptsConfig, TestValidator, WithPath, @@ -3813,7 +3811,7 @@ fn upgrade( .arg("--url") .arg(url) .arg("--keypair") - .arg(&cfg.provider.wallet.to_string()) + .arg(cfg.provider.wallet.to_string()) .arg("--program-id") .arg(strip_workspace_prefix(program_id.to_string())) .arg(strip_workspace_prefix(program_filepath)) diff --git a/lang/src/accounts/account.rs b/lang/src/accounts/account.rs index b554167fb1..0ba1e974b0 100644 --- a/lang/src/accounts/account.rs +++ b/lang/src/accounts/account.rs @@ -86,6 +86,7 @@ use std::ops::{Deref, DerefMut}; /// those programs are not annotated with `#[account]` so you have to /// - create a wrapper type around the structs you want to wrap with Account /// - implement the functions required by Account yourself +/// /// instead of using `#[account]`. You only have to implement a fraction of the /// functions `#[account]` generates. See the example below for the code you have /// to write. diff --git a/lang/src/accounts/account_loader.rs b/lang/src/accounts/account_loader.rs index 76676b70c1..a7392299e6 100644 --- a/lang/src/accounts/account_loader.rs +++ b/lang/src/accounts/account_loader.rs @@ -23,7 +23,7 @@ use std::ops::DerefMut; /// for example, the [`Account`](crate::accounts::account::Account). Namely, /// one must call /// - `load_init` after initializing an account (this will ignore the missing -/// account discriminator that gets added only after the user's instruction code) +/// account discriminator that gets added only after the user's instruction code) /// - `load` when the account is not mutable /// - `load_mut` when the account is mutable /// diff --git a/lang/src/accounts/interface.rs b/lang/src/accounts/interface.rs index 90e331538a..b5cf1f181d 100644 --- a/lang/src/accounts/interface.rs +++ b/lang/src/accounts/interface.rs @@ -59,9 +59,9 @@ use std::ops::Deref; /// The required constraints are as follows: /// /// - `program` is the account of the program itself. -/// Its constraint checks that `program_data` is the account that contains the program's upgrade authority. -/// Implicitly, this checks that `program` is a BPFUpgradeable program (`program.programdata_address()?` -/// will be `None` if it's not). +/// Its constraint checks that `program_data` is the account that contains the program's upgrade authority. +/// Implicitly, this checks that `program` is a BPFUpgradeable program (`program.programdata_address()?` +/// will be `None` if it's not). /// - `program_data`'s constraint checks that its upgrade authority is the `authority` account. /// - Finally, `authority` needs to sign the transaction. /// diff --git a/lang/src/accounts/interface_account.rs b/lang/src/accounts/interface_account.rs index 5401641725..fd2a6e1695 100644 --- a/lang/src/accounts/interface_account.rs +++ b/lang/src/accounts/interface_account.rs @@ -86,6 +86,7 @@ use std::ops::{Deref, DerefMut}; /// those programs are not annotated with `#[account]` so you have to /// - create a wrapper type around the structs you want to wrap with InterfaceAccount /// - implement the functions required by InterfaceAccount yourself +/// /// instead of using `#[account]`. You only have to implement a fraction of the /// functions `#[account]` generates. See the example below for the code you have /// to write. diff --git a/lang/src/accounts/program.rs b/lang/src/accounts/program.rs index aa1f1c6fbd..1058b62a58 100644 --- a/lang/src/accounts/program.rs +++ b/lang/src/accounts/program.rs @@ -59,9 +59,9 @@ use std::ops::Deref; /// The required constraints are as follows: /// /// - `program` is the account of the program itself. -/// Its constraint checks that `program_data` is the account that contains the program's upgrade authority. -/// Implicitly, this checks that `program` is a BPFUpgradeable program (`program.programdata_address()?` -/// will be `None` if it's not). +/// Its constraint checks that `program_data` is the account that contains the program's upgrade authority. +/// Implicitly, this checks that `program` is a BPFUpgradeable program (`program.programdata_address()?` +/// will be `None` if it's not). /// - `program_data`'s constraint checks that its upgrade authority is the `authority` account. /// - Finally, `authority` needs to sign the transaction. /// diff --git a/lang/src/lib.rs b/lang/src/lib.rs index e6b0d0493f..a169159ec3 100644 --- a/lang/src/lib.rs +++ b/lang/src/lib.rs @@ -193,7 +193,7 @@ pub trait Lamports<'info>: AsRef> { /// /// 1. The account must be marked `mut`. /// 2. The total lamports **before** the transaction must equal to total lamports **after** - /// the transaction. + /// the transaction. /// 3. `lamports` field of the account info should not currently be borrowed. /// /// See [`Lamports::sub_lamports`] for subtracting lamports. @@ -214,7 +214,7 @@ pub trait Lamports<'info>: AsRef> { /// 1. The account must be owned by the executing program. /// 2. The account must be marked `mut`. /// 3. The total lamports **before** the transaction must equal to total lamports **after** - /// the transaction. + /// the transaction. /// 4. `lamports` field of the account info should not currently be borrowed. /// /// See [`Lamports::add_lamports`] for adding lamports.