diff --git a/avm/src/lib.rs b/avm/src/lib.rs index 5d50ad2bbe..646041e434 100644 --- a/avm/src/lib.rs +++ b/avm/src/lib.rs @@ -251,7 +251,7 @@ pub fn install_version( let target = core::str::from_utf8(&output.stdout)? .lines() .find(|line| line.starts_with("host:")) - .and_then(|line| line.split(':').last()) + .and_then(|line| line.split(':').next_back()) .ok_or_else(|| anyhow!("`host` not found from `rustc -vV` output"))? .trim(); let ext = if cfg!(target_os = "windows") { diff --git a/cli/src/lib.rs b/cli/src/lib.rs index 3404b03261..bd4f9694cd 100644 --- a/cli/src/lib.rs +++ b/cli/src/lib.rs @@ -4237,14 +4237,14 @@ fn airdrop(cfg_override: &ConfigOverride) -> Result<()> { let url = cfg_override .cluster .as_ref() - .unwrap_or_else(|| &Cluster::Devnet) + .unwrap_or(&Cluster::Devnet) .url(); loop { let exit = std::process::Command::new("solana") .arg("airdrop") .arg("10") .arg("--url") - .arg(&url) + .arg(url) .stdout(Stdio::inherit()) .stderr(Stdio::inherit()) .output() diff --git a/client/src/nonblocking.rs b/client/src/nonblocking.rs index 317bc0775a..6d8f4260f7 100644 --- a/client/src/nonblocking.rs +++ b/client/src/nonblocking.rs @@ -12,7 +12,7 @@ use solana_sdk::{ use std::{marker::PhantomData, ops::Deref, sync::Arc}; use tokio::sync::RwLock; -impl<'a> EventUnsubscriber<'a> { +impl EventUnsubscriber<'_> { /// Unsubscribe gracefully. pub async fn unsubscribe(self) { self.unsubscribe_internal().await diff --git a/lang/src/accounts/account_loader.rs b/lang/src/accounts/account_loader.rs index d9b172b28f..8bc2ef6d7a 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 8fe9254958..8f742014e6 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/program.rs b/lang/src/accounts/program.rs index 701edb16a6..862f0dd154 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/syn/src/idl/accounts.rs b/lang/syn/src/idl/accounts.rs index 56d85618bc..d81582374f 100644 --- a/lang/syn/src/idl/accounts.rs +++ b/lang/syn/src/idl/accounts.rs @@ -417,10 +417,10 @@ impl SeedPath { // Check unsupported cases e.g. `&(account.field + 1).to_le_bytes()` if !seed_str.contains('"') - && seed_str.contains(|c: char| matches!(c, '+' | '-' | '*' | '/' | '%' | '^')) - { - return Err(anyhow!("Seed expression not supported: {seed:#?}")); - } + && seed_str.contains(|c: char| ['+', '-', '*', '/', '%', '^'].contains(&c)) +{ + return Err(anyhow!("Seed expression not supported: {seed:#?}")); +} // Break up the seed into each subfield component. let mut components = seed_str.split('.').collect::>(); diff --git a/lang/syn/src/idl/defined.rs b/lang/syn/src/idl/defined.rs index 334387a20c..e8a3559b52 100644 --- a/lang/syn/src/idl/defined.rs +++ b/lang/syn/src/idl/defined.rs @@ -359,7 +359,7 @@ pub fn gen_idl_type( if path.path.segments.len() != 1 { return false; }; - return get_first_segment(path).ident == cmp; + get_first_segment(path).ident == cmp } fn get_angle_bracketed_type_args(seg: &syn::PathSegment) -> Vec<&syn::Type> { diff --git a/lang/syn/src/idl/external.rs b/lang/syn/src/idl/external.rs index e6e5f58093..bd7f6bc7c0 100644 --- a/lang/syn/src/idl/external.rs +++ b/lang/syn/src/idl/external.rs @@ -99,7 +99,7 @@ fn parse_lock_file(path: impl AsRef) -> Result> { let get_value = |key: &str| -> String { pkg.lines() .find(|line| line.starts_with(key)) - .expect(&format!("`{key}` line not found")) + .unwrap_or_else(|| panic!("`{key}` line not found")) .split('"') .nth(1) .unwrap() diff --git a/lang/syn/src/parser/program/instructions.rs b/lang/syn/src/parser/program/instructions.rs index 42ece0423d..cca0e9b994 100644 --- a/lang/syn/src/parser/program/instructions.rs +++ b/lang/syn/src/parser/program/instructions.rs @@ -129,7 +129,7 @@ pub fn parse_return(method: &syn::ItemFn) -> ParseResult { // Assume unit return by default let default_generic_arg = syn::GenericArgument::Type(syn::parse_str("()").unwrap()); let generic_args = match &ty.path.segments.last().unwrap().arguments { - syn::PathArguments::AngleBracketed(params) => params.args.iter().last().unwrap(), + syn::PathArguments::AngleBracketed(params) => params.args.iter().next_back().unwrap(), _ => &default_generic_arg, }; let ty = match generic_args {