Skip to content

Commit

Permalink
Fix clippy 1.84.0 (#3511)
Browse files Browse the repository at this point in the history
  • Loading branch information
acheroncrypto authored Jan 25, 2025
1 parent 5d0fe35 commit dda393f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ The minor version will be incremented upon a breaking change and the patch versi
- cli: Fix altering user-provided lib names ([#3467](https://github.com/coral-xyz/anchor/pull/3467)).
- idl: Fix missing `program::seed` resolution ([#3474](https://github.com/coral-xyz/anchor/pull/3474)).
- lang: Fix adding `derive`s and `repr`s to type alias definitions in `declare_program!` ([#3504](https://github.com/coral-xyz/anchor/pull/3504)).
- spl: Add `anchor-debug` feature ([#3511](https://github.com/coral-xyz/anchor/pull/3511)).

### Breaking

Expand Down
8 changes: 4 additions & 4 deletions client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ pub struct EventUnsubscriber<'a> {
_lifetime_marker: PhantomData<&'a Handle>,
}

impl<'a> EventUnsubscriber<'a> {
impl EventUnsubscriber<'_> {
async fn unsubscribe_internal(mut self) {
if let Some(unsubscribe) = self.rx.recv().await {
unsubscribe().await;
Expand Down Expand Up @@ -522,7 +522,7 @@ pub struct RequestBuilder<'a, C, S: 'a> {
}

// Shared implementation for all RequestBuilders
impl<'a, C: Deref<Target = impl Signer> + Clone, S: AsSigner> RequestBuilder<'a, C, S> {
impl<C: Deref<Target = impl Signer> + Clone, S: AsSigner> RequestBuilder<'_, C, S> {
#[must_use]
pub fn payer(mut self, payer: C) -> Self {
self.payer = payer;
Expand Down Expand Up @@ -679,6 +679,7 @@ fn parse_logs_response<T: anchor_lang::Event + anchor_lang::AnchorDeserialize>(
if let Ok(mut execution) = Execution::new(&mut logs) {
// Create a new peekable iterator so that we can peek at the next log whilst iterating
let mut logs_iter = logs.iter().peekable();
let regex = Regex::new(r"^Program (.*) invoke.*$").unwrap();

while let Some(l) = logs_iter.next() {
// Parse the log.
Expand Down Expand Up @@ -714,9 +715,8 @@ fn parse_logs_response<T: anchor_lang::Event + anchor_lang::AnchorDeserialize>(
// a panic during the next iteration.
if let Some(&next_log) = logs_iter.peek() {
if next_log.ends_with("invoke [1]") {
let re = Regex::new(r"^Program (.*) invoke.*$").unwrap();
let next_instruction =
re.captures(next_log).unwrap().get(1).unwrap().as_str();
regex.captures(next_log).unwrap().get(1).unwrap().as_str();
// Within this if block, there will always be a regex match.
// Therefore it's safe to unwrap and the captured program ID
// at index 1 can also be safely unwrapped.
Expand Down
2 changes: 1 addition & 1 deletion lang/syn/src/parser/accounts/constraints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub fn parse(f: &syn::Field, f_ty: Option<&Ty>) -> ParseResult<ConstraintGroup>
pub fn is_account(attr: &&syn::Attribute) -> bool {
attr.path
.get_ident()
.map_or(false, |ident| ident == "account")
.is_some_and(|ident| ident == "account")
}

// Parses a single constraint from a parse stream for `#[account(<STREAM>)]`.
Expand Down
2 changes: 1 addition & 1 deletion lang/syn/src/parser/accounts/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub fn parse(accounts_struct: &syn::ItemStruct) -> ParseResult<AccountsStruct> {
.find(|a| {
a.path
.get_ident()
.map_or(false, |ident| ident == "instruction")
.is_some_and(|ident| ident == "instruction")
})
.map(|ix_attr| ix_attr.parse_args_with(Punctuated::<Expr, Comma>::parse_terminated))
.transpose()?;
Expand Down
1 change: 1 addition & 0 deletions spl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ rustdoc-args = ["--cfg", "docsrs"]

[features]
default = ["associated_token", "mint", "token", "token_2022", "token_2022_extensions"]
anchor-debug = ["anchor-lang/anchor-debug"]
associated_token = ["spl-associated-token-account"]
devnet = []
governance = []
Expand Down

0 comments on commit dda393f

Please sign in to comment.