Skip to content

Commit

Permalink
Fix clippy 1.80.0 lints (#3145)
Browse files Browse the repository at this point in the history
  • Loading branch information
acheroncrypto authored Aug 2, 2024
1 parent 56af130 commit 98396c0
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 12 deletions.
2 changes: 2 additions & 0 deletions cli/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Path>) -> Result<Self, Error> {
let s = fs::read_to_string(&path)?;
let parsed_toml: Self = toml::from_str(&s)?;
Expand Down
4 changes: 1 addition & 3 deletions cli/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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))
Expand Down
1 change: 1 addition & 0 deletions lang/src/accounts/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion lang/src/accounts/account_loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
///
Expand Down
6 changes: 3 additions & 3 deletions lang/src/accounts/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down
1 change: 1 addition & 0 deletions lang/src/accounts/interface_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions lang/src/accounts/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down
4 changes: 2 additions & 2 deletions lang/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ pub trait Lamports<'info>: AsRef<AccountInfo<'info>> {
///
/// 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.
Expand All @@ -214,7 +214,7 @@ pub trait Lamports<'info>: AsRef<AccountInfo<'info>> {
/// 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.
Expand Down

0 comments on commit 98396c0

Please sign in to comment.