Skip to content

Commit

Permalink
Lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Rigidity committed Feb 27, 2025
1 parent 11788f3 commit cf07e3d
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 16 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ unwrap_used = "warn"
wildcard_imports = "allow"
cast_possible_truncation = "allow"
cast_sign_loss = "allow"
cast_lossless = "allow"

[workspace.dependencies]
sage = { path = "./crates/sage" }
Expand Down
2 changes: 1 addition & 1 deletion crates/sage-api/macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ fn convert(
TokenTree::Group(group) => {
let mut stream = group.stream().into_iter().peekable();

let repeat = stream.peek().map_or(false, |token| {
let repeat = stream.peek().is_some_and(|token| {
if let TokenTree::Ident(ident) = &token {
ident.to_string() == "repeat" && group.delimiter() == Delimiter::Parenthesis
} else {
Expand Down
2 changes: 1 addition & 1 deletion crates/sage-database/src/coin_states.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl Database {
}
}

impl<'a> DatabaseTx<'a> {
impl DatabaseTx<'_> {
pub async fn insert_coin_state(
&mut self,
coin_state: CoinState,
Expand Down
2 changes: 1 addition & 1 deletion crates/sage-database/src/derivations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl Database {
}
}

impl<'a> DatabaseTx<'a> {
impl DatabaseTx<'_> {
pub async fn insert_derivation(
&mut self,
p2_puzzle_hash: Bytes32,
Expand Down
2 changes: 1 addition & 1 deletion crates/sage-database/src/peaks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ impl Database {
}
}

impl<'a> DatabaseTx<'a> {
impl DatabaseTx<'_> {
pub async fn latest_peak(&mut self) -> Result<Option<(u32, Bytes32)>> {
latest_peak(&mut *self.tx).await
}
Expand Down
2 changes: 1 addition & 1 deletion crates/sage-database/src/primitives/cats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl Database {
}
}

impl<'a> DatabaseTx<'a> {
impl DatabaseTx<'_> {
pub async fn insert_cat(&mut self, row: CatRow) -> Result<()> {
insert_cat(&mut *self.tx, row).await
}
Expand Down
2 changes: 1 addition & 1 deletion crates/sage-database/src/primitives/dids.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl Database {
}
}

impl<'a> DatabaseTx<'a> {
impl DatabaseTx<'_> {
pub async fn insert_did(&mut self, row: DidRow) -> Result<()> {
insert_did(&mut *self.tx, row).await
}
Expand Down
14 changes: 7 additions & 7 deletions crates/sage-database/src/primitives/nfts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ impl Database {
}
}

impl<'a> DatabaseTx<'a> {
impl DatabaseTx<'_> {
pub async fn insert_nft_coin(
&mut self,
coin_id: Bytes32,
Expand Down Expand Up @@ -870,11 +870,11 @@ async fn search_nfts(

// Common parts
let order_by = format!(
r#"ORDER BY {visible_order}
r"ORDER BY {visible_order}
is_pending DESC,
{sort_order},
launcher_id ASC
LIMIT ? OFFSET ?"#,
LIMIT ? OFFSET ?",
visible_order = if params.include_hidden {
"visible DESC,"
} else {
Expand Down Expand Up @@ -920,7 +920,7 @@ async fn search_nfts(
// Construct query based on whether we're doing a name search
let query = if params.name.is_some() {
format!(
r#"
r"
WITH matched_names AS (
SELECT launcher_id
FROM nft_name_fts
Expand All @@ -932,16 +932,16 @@ async fn search_nfts(
INNER JOIN matched_names ON nfts.launcher_id = matched_names.launcher_id
WHERE {where_clause}
{order_by}
"#
"
)
} else {
format!(
r#"
r"
SELECT *, COUNT(*) OVER() as total_count
FROM nfts INDEXED BY {index}
WHERE {where_clause}
{order_by}
"#
"
)
};

Expand Down
2 changes: 1 addition & 1 deletion crates/sage-database/src/primitives/xch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl Database {
}
}

impl<'a> DatabaseTx<'a> {
impl DatabaseTx<'_> {
pub async fn insert_p2_coin(&mut self, coin_id: Bytes32) -> Result<()> {
insert_p2_coin(&mut *self.tx, coin_id).await
}
Expand Down
2 changes: 1 addition & 1 deletion crates/sage-database/src/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl Database {
}
}

impl<'a> DatabaseTx<'a> {
impl DatabaseTx<'_> {
pub async fn insert_pending_transaction(
&mut self,
transaction_id: Bytes32,
Expand Down
2 changes: 1 addition & 1 deletion crates/sage-wallet/src/queues/nft_uri_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ impl NftUriQueue {

let existing = tx.fetch_nft_data(item.hash).await?;

if existing.as_ref().map_or(true, |data| !data.hash_matches) {
if existing.as_ref().is_none_or(|data| !data.hash_matches) {
tx.insert_nft_data(
item.hash,
NftData {
Expand Down

0 comments on commit cf07e3d

Please sign in to comment.