From f805b6b5dd742c95198a72304ad7864b57ca0738 Mon Sep 17 00:00:00 2001 From: Duy Do Date: Wed, 8 Nov 2023 23:55:20 +0700 Subject: [PATCH] Use BTreeSet (#5) --- .../cmds-solana/src/nft/candy_machine_v3/add_config_lines.rs | 1 - crates/cmds-solana/src/nft/candy_machine_v3/initialize.rs | 1 - .../src/nft/candy_machine_v3/initialize_candy_guard.rs | 5 ++--- crates/cmds-solana/src/nft/candy_machine_v3/mint.rs | 1 - crates/cmds-solana/src/nft/candy_machine_v3/wrap.rs | 4 +--- crates/cmds-std/src/storage/upload.rs | 2 +- crates/flow-server/src/main.rs | 5 ++--- 7 files changed, 6 insertions(+), 13 deletions(-) diff --git a/crates/cmds-solana/src/nft/candy_machine_v3/add_config_lines.rs b/crates/cmds-solana/src/nft/candy_machine_v3/add_config_lines.rs index 56611c63..b1a652ff 100644 --- a/crates/cmds-solana/src/nft/candy_machine_v3/add_config_lines.rs +++ b/crates/cmds-solana/src/nft/candy_machine_v3/add_config_lines.rs @@ -14,7 +14,6 @@ const DEFINITION: &str = flow_lib::node_definition!("solana/NFT/candy_machine/add_config_lines.json"); fn build() -> BuildResult { - use once_cell::sync::Lazy; static CACHE: BuilderCache = BuilderCache::new(|| { CmdBuilder::new(DEFINITION)? .check_name(ADD_CONFIG_LINES)? diff --git a/crates/cmds-solana/src/nft/candy_machine_v3/initialize.rs b/crates/cmds-solana/src/nft/candy_machine_v3/initialize.rs index e8bb3d8f..820490ca 100644 --- a/crates/cmds-solana/src/nft/candy_machine_v3/initialize.rs +++ b/crates/cmds-solana/src/nft/candy_machine_v3/initialize.rs @@ -18,7 +18,6 @@ const INITIALIZE_CANDY_MACHINE: &str = "initialize_candy_machine"; const DEFINITION: &str = flow_lib::node_definition!("solana/NFT/candy_machine/initialize.json"); fn build() -> BuildResult { - use once_cell::sync::Lazy; static CACHE: BuilderCache = BuilderCache::new(|| { CmdBuilder::new(DEFINITION)? .check_name(INITIALIZE_CANDY_MACHINE)? diff --git a/crates/cmds-solana/src/nft/candy_machine_v3/initialize_candy_guard.rs b/crates/cmds-solana/src/nft/candy_machine_v3/initialize_candy_guard.rs index 02e78283..dc127925 100644 --- a/crates/cmds-solana/src/nft/candy_machine_v3/initialize_candy_guard.rs +++ b/crates/cmds-solana/src/nft/candy_machine_v3/initialize_candy_guard.rs @@ -7,11 +7,10 @@ use solana_sdk::pubkey::Pubkey; // Command Name const INITIALIZE_CANDY_GUARD: &str = "initialize_candy_guard"; -const DEFINITION: &str = flow_lib::node_definition!("solana/NFT/candy_machine/initialize_candy_guard.json" -); +const DEFINITION: &str = + flow_lib::node_definition!("solana/NFT/candy_machine/initialize_candy_guard.json"); fn build() -> BuildResult { - use once_cell::sync::Lazy; static CACHE: BuilderCache = BuilderCache::new(|| { CmdBuilder::new(DEFINITION)? .check_name(INITIALIZE_CANDY_GUARD)? diff --git a/crates/cmds-solana/src/nft/candy_machine_v3/mint.rs b/crates/cmds-solana/src/nft/candy_machine_v3/mint.rs index d3ea6ca5..f2ffcc28 100644 --- a/crates/cmds-solana/src/nft/candy_machine_v3/mint.rs +++ b/crates/cmds-solana/src/nft/candy_machine_v3/mint.rs @@ -17,7 +17,6 @@ const MINT: &str = "mint"; const DEFINITION: &str = flow_lib::node_definition!("solana/NFT/candy_machine/mint.json"); fn build() -> BuildResult { - use once_cell::sync::Lazy; static CACHE: BuilderCache = BuilderCache::new(|| { CmdBuilder::new(DEFINITION)? .check_name(MINT)? diff --git a/crates/cmds-solana/src/nft/candy_machine_v3/wrap.rs b/crates/cmds-solana/src/nft/candy_machine_v3/wrap.rs index a97c7944..6391e009 100644 --- a/crates/cmds-solana/src/nft/candy_machine_v3/wrap.rs +++ b/crates/cmds-solana/src/nft/candy_machine_v3/wrap.rs @@ -6,11 +6,9 @@ use solana_sdk::pubkey::Pubkey; // Command Name const WRAP: &str = "wrap"; -const DEFINITION: &str = - flow_lib::node_definition!("solana/NFT/candy_machine/wrap.json"); +const DEFINITION: &str = flow_lib::node_definition!("solana/NFT/candy_machine/wrap.json"); fn build() -> BuildResult { - use once_cell::sync::Lazy; static CACHE: BuilderCache = BuilderCache::new(|| { CmdBuilder::new(DEFINITION)? .check_name(WRAP)? diff --git a/crates/cmds-std/src/storage/upload.rs b/crates/cmds-std/src/storage/upload.rs index e5c8a433..dd61bd17 100644 --- a/crates/cmds-std/src/storage/upload.rs +++ b/crates/cmds-std/src/storage/upload.rs @@ -1,6 +1,6 @@ use crate::supabase_error; -use flow_lib::command::prelude::*; use bytes::Bytes; +use flow_lib::command::prelude::*; use mime_guess::MimeGuess; use reqwest::{ header::{AUTHORIZATION, CONTENT_TYPE}, diff --git a/crates/flow-server/src/main.rs b/crates/flow-server/src/main.rs index 7f218d02..9a9a0a4e 100644 --- a/crates/flow-server/src/main.rs +++ b/crates/flow-server/src/main.rs @@ -12,8 +12,7 @@ use flow_server::{ wss, Config, }; use futures_util::{future::ok, TryFutureExt}; -use hashbrown::HashSet; -use std::{borrow::Cow, convert::Infallible}; +use std::{borrow::Cow, collections::BTreeSet, convert::Infallible}; use utils::address_book::AddressBook; // avoid commands being optimized out by the compiler @@ -89,7 +88,7 @@ async fn main() { .get_admin_conn() .and_then(move |conn| async move { let names = conn.get_natives_commands().await?; - let mut missing = HashSet::new(); + let mut missing = BTreeSet::new(); for name in names { if !natives.contains(&&Cow::Borrowed(name.as_str())) { missing.insert(name);