Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahSaso committed Feb 26, 2025
1 parent 178fdd1 commit a27de9f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions contracts/test/dao-voting-cw20-balance/src/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use cw20_base::msg::InstantiateMarketingInfo;
use dao_dao_macros::{cw20_token_query, voting_module_query};

#[cw_serde]
#[allow(clippy::large_enum_variant)]
pub enum TokenInfo {
Existing {
address: String,
Expand Down
1 change: 1 addition & 0 deletions contracts/voting/dao-voting-token-staked/src/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use dao_interface::token::NewTokenInfo;
use dao_voting::threshold::{ActiveThreshold, ActiveThresholdResponse};

#[cw_serde]
#[allow(clippy::large_enum_variant)]
pub enum TokenInfo {
/// Uses an existing Token Factory token and creates a new issuer contract.
/// Full setup, such as transferring ownership or setting up MsgSetBeforeSendHook,
Expand Down
11 changes: 5 additions & 6 deletions packages/cw-snapshot-vector-map/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,8 @@ where
let mut active = self.active.may_load(store, k.clone())?.unwrap_or_default();

// remove expired items
active.retain(|(_, expiration)| {
expiration.map_or(true, |expiration| expiration > curr_height)
});
active
.retain(|(_, expiration)| expiration.is_none_or(|expiration| expiration > curr_height));

// add new item and save list
let expiration = expire_in.map(|d| curr_height + d);
Expand Down Expand Up @@ -149,7 +148,7 @@ where

// remove item and any expired items
active.retain(|(active_id, expiration)| {
active_id != &id && expiration.map_or(true, |expiration| expiration > curr_height)
active_id != &id && expiration.is_none_or(|expiration| expiration > curr_height)
});

// save the new list
Expand Down Expand Up @@ -209,7 +208,7 @@ where
// load paged items, skipping expired ones
let items = active_ids
.iter()
.filter(|(_, expiration)| expiration.map_or(true, |exp| exp > height))
.filter(|(_, expiration)| expiration.is_none_or(|exp| exp > height))
.skip(offset)
.take(limit)
.map(|(id, expiration)| -> StdResult<LoadedItem<V>> {
Expand Down Expand Up @@ -260,7 +259,7 @@ where
// load paged items, skipping expired ones
let items = active_ids
.iter()
.filter(|(_, expiration)| expiration.map_or(true, |exp| exp > current_height))
.filter(|(_, expiration)| expiration.is_none_or(|exp| exp > current_height))
.skip(offset)
.take(limit)
.map(|(id, expiration)| -> StdResult<LoadedItem<V>> {
Expand Down

0 comments on commit a27de9f

Please sign in to comment.