Skip to content

Commit

Permalink
Cherry-picked Fix Rust 1.75 warnings (kaspanet#372)
Browse files Browse the repository at this point in the history
* fix new unused imports warns by running `cargo clippy --fix --all --tests --benches --features devnet-prealloc`
note that all these `pub use` were not really exposed publicly on the crate level

* fix `variant name ends with the enum's name` warnings
  • Loading branch information
michaelsutton authored and KashProtocol committed Jan 8, 2024
1 parent 7fbc2e5 commit a9d1f9b
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 50 deletions.
11 changes: 3 additions & 8 deletions cli/src/imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@ pub use crate::notifier::Notification;
pub use crate::result::Result;
pub use crate::utils::*;
pub use async_trait::async_trait;
pub use borsh::{BorshDeserialize, BorshSerialize};
pub use cfg_if::cfg_if;
pub use futures::stream::{Stream, StreamExt, TryStreamExt};
pub use futures::{future::FutureExt, select, Future};
pub use futures::{future::FutureExt, select};
pub use kash_consensus_core::network::{NetworkId, NetworkType};
pub use kash_daemon::DaemonEvent;
pub use kash_utils::hex::*;
pub use kash_wallet_core::derivation::gen0::import::*;
pub use kash_wallet_core::prelude::*;
Expand All @@ -22,15 +20,12 @@ pub use regex::Regex;
pub use separator::Separatable;
pub use serde::{Deserialize, Serialize};
pub use serde_json::{to_value, Value};
pub use std::cmp;
pub use std::collections::HashMap;
pub use std::collections::VecDeque;
pub use std::ops::Deref;
pub use std::path::{Path, PathBuf};
pub use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
pub use std::sync::{Arc, Mutex, MutexGuard};
pub use std::sync::atomic::{AtomicBool, Ordering};
pub use std::sync::{Arc, Mutex};
pub use workflow_core::prelude::*;
pub use workflow_core::runtime as application_runtime;
pub use workflow_log::*;
pub use workflow_nw::ipc::result::Result as IpcResult;
pub use workflow_terminal::prelude::*;
1 change: 0 additions & 1 deletion consensus/src/processes/transaction_validator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use kash_txscript::{
caches::{Cache, TxScriptCacheCounters},
SigCacheKey,
};
pub use tx_validation_in_isolation::*;

#[derive(Clone)]
pub struct TransactionValidator {
Expand Down
1 change: 0 additions & 1 deletion kos/src/core/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#[allow(clippy::module_inception)]
mod core;
pub use self::core::*;
mod ipc;
pub use ipc::*;
mod settings;
Expand Down
14 changes: 7 additions & 7 deletions kos/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,22 @@ pub enum Error {
Terminal(#[from] workflow_terminal::error::Error),

#[error("channel error")]
RecvError(#[from] workflow_core::channel::RecvError),
Recv(#[from] workflow_core::channel::RecvError),

#[error(transparent)]
CallbackError(#[from] workflow_wasm::callback::CallbackError),
Callback(#[from] workflow_wasm::callback::CallbackError),

#[error("{0}")]
DowncastError(String),
Downcast(String),

#[error("Channel error")]
ChannelError(String),
Channel(String),

#[error(transparent)]
Daemon(#[from] kash_daemon::error::Error),

#[error(transparent)]
WalletError(#[from] kash_wallet_core::error::Error),
Wallet(#[from] kash_wallet_core::error::Error),

#[error(transparent)]
Dom(#[from] workflow_dom::error::Error),
Expand Down Expand Up @@ -96,12 +96,12 @@ impl From<&str> for Error {

impl<T> From<DowncastError<T>> for Error {
fn from(e: DowncastError<T>) -> Self {
Error::DowncastError(e.to_string())
Error::Downcast(e.to_string())
}
}

impl<T> From<ChannelError<T>> for Error {
fn from(e: ChannelError<T>) -> Error {
Error::ChannelError(e.to_string())
Error::Channel(e.to_string())
}
}
16 changes: 4 additions & 12 deletions kos/src/imports.rs
Original file line number Diff line number Diff line change
@@ -1,38 +1,30 @@
pub use crate::core::MetricsCtl;
pub use crate::core::*;
pub use crate::error::Error;
pub use crate::ipc::*;
pub use crate::layout::Layout;
pub use crate::metrics::*;
pub use crate::result::Result;
pub use crate::terminal::*;
pub use async_trait::async_trait;
pub use borsh::{BorshDeserialize, BorshSerialize};
pub use futures::{future::join_all, select, select_biased, stream::StreamExt, FutureExt, Stream};
pub use futures::{select, stream::StreamExt, FutureExt};
pub use kash_cli_lib::{KashCli, Options as KashCliOptions};
pub use kash_consensus_core::network::NetworkType;
pub use kash_daemon::{
CpuMiner, CpuMinerConfig, CpuMinerCtl, DaemonEvent, DaemonKind, DaemonStatus, Daemons, Kashd, KashdConfig, KashdCtl,
Result as DaemonResult,
};
pub use kash_wallet_core::settings::{DefaultSettings, SettingsStore, SettingsStoreT};
pub use nw_sys::prelude::*;
pub use regex::Regex;
pub use serde::{Deserialize, Serialize};
pub use serde_json::{to_value, Value};
pub use std::path::{Path, PathBuf};
pub use std::sync::atomic::{AtomicBool, AtomicU64, Ordering};
pub use serde_json::Value;
pub use wasm_bindgen::prelude::*;
pub use workflow_core::channel::*;
pub use workflow_core::enums::Describe;
pub use workflow_core::runtime::*;
pub use workflow_core::task::*;
pub use workflow_core::time::*;
pub use workflow_d3::*;
pub use workflow_log::*;
pub use workflow_nw::ipc::result::Result as IpcResult;
pub use workflow_nw::ipc::*;
pub use workflow_nw::prelude::*;
pub use workflow_terminal::prelude::*;
pub use workflow_terminal::{CrLf, Modifiers, Options as TerminalOptions};
pub use workflow_wasm::callback::{callback, AsCallback, Callback, CallbackMap};
pub use workflow_terminal::{CrLf, Options as TerminalOptions};
pub use workflow_wasm::callback::{callback, AsCallback, CallbackMap};
3 changes: 1 addition & 2 deletions kos/src/metrics/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
mod ipc;
#[allow(clippy::module_inception)]
mod metrics;
pub use metrics::*;
mod ipc;
pub use ipc::*;
mod settings;
pub use settings::*;
Expand Down
3 changes: 1 addition & 2 deletions kos/src/terminal/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
mod ipc;
#[allow(clippy::module_inception)]
mod terminal;
pub use terminal::*;
mod ipc;
pub use ipc::*;
mod settings;
pub use settings::*;
2 changes: 1 addition & 1 deletion rpc/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub mod prelude {
}

pub use api::notifications::*;
pub use convert::{block::*, notification::*, tx::*, utxo::*};
pub use convert::utxo::*;
pub use error::*;
pub use model::script_class::*;
pub use model::*;
4 changes: 1 addition & 3 deletions rpc/wrpc/client/src/imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ pub use kash_rpc_core::{
api::ops::RpcApiOps,
api::rpc::RpcApi,
error::RpcResult,
notify::{collector::RpcCoreCollector, connection::ChannelConnection, mode::NotificationMode},
notify::{connection::ChannelConnection, mode::NotificationMode},
prelude::*,
};
pub use regex::Regex;
pub use std::sync::{
atomic::{AtomicBool, Ordering},
Arc, Mutex,
Expand All @@ -27,7 +26,6 @@ pub use wasm_bindgen::prelude::*;
pub use workflow_core::{
channel::{Channel, DuplexChannel, Receiver},
task::spawn,
trigger::Listener,
};
pub use workflow_log::*;
pub use workflow_rpc::client::prelude::{Encoding as WrpcEncoding, *};
2 changes: 1 addition & 1 deletion rpc/wrpc/proxy/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub enum Error {
WebSocket(#[from] workflow_rpc::server::WebSocketError),

#[error(transparent)]
RpcError(#[from] workflow_rpc::error::Error),
WorkflowRpc(#[from] workflow_rpc::error::Error),
}

impl From<String> for Error {
Expand Down
3 changes: 0 additions & 3 deletions wallet/bip32/src/mnemonic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,3 @@ mod phrase;
pub(crate) mod seed;

pub use self::{language::Language, phrase::Mnemonic, phrase::WordCount};

//#[cfg(feature = "bip39")]
pub use self::seed::Seed;
12 changes: 4 additions & 8 deletions wallet/core/src/imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! are used internally in the wallet framework core.
//!
pub use crate::account::descriptor::{AccountDescriptor, AccountDescriptorProperty, AccountDescriptorValue};
pub use crate::account::descriptor::{AccountDescriptor, AccountDescriptorProperty};
pub use crate::account::variants::*;
pub use crate::account::{Account, AccountKind, DerivationCapableAccount};
pub use crate::deterministic::*;
Expand All @@ -22,7 +22,7 @@ pub use crate::utxo::balance::Balance;
pub use crate::utxo::scan::{Scan, ScanExtent};
pub use crate::utxo::{Maturity, OutgoingTransaction, UtxoContext, UtxoEntryReference, UtxoProcessor};
pub use crate::wallet::*;
pub use crate::{storage, utils, utxo};
pub use crate::{storage, utils};

pub use ahash::{AHashMap, AHashSet};
pub use async_trait::async_trait;
Expand All @@ -31,13 +31,10 @@ pub use cfg_if::cfg_if;
pub use dashmap::{DashMap, DashSet};
pub use downcast::{downcast_sync, AnySync};
pub use futures::future::join_all;
pub use futures::{select, select_biased, stream, FutureExt, Stream, StreamExt, TryStreamExt};
pub use futures::{select, select_biased, FutureExt, Stream, StreamExt, TryStreamExt};
pub use js_sys::{Array, BigInt, Object};
pub use kash_addresses::{Address, Prefix};
pub use kash_consensus_core::network::{NetworkId, NetworkType};
pub use kash_consensus_core::subnets;
pub use kash_consensus_core::subnets::SubnetworkId;
pub use kash_consensus_core::tx as cctx;
pub use kash_consensus_core::tx::{ScriptPublicKey, TransactionId, TransactionIndexType};
pub use kash_utils::hashmap::*;
pub use kash_utils::hex::{FromHex, ToHex};
Expand All @@ -48,13 +45,12 @@ pub use std::collections::{HashMap, HashSet};
pub use std::pin::Pin;
pub use std::str::FromStr;
pub use std::sync::atomic::{AtomicBool, AtomicU64, AtomicUsize, Ordering};
pub use std::sync::{Arc, Mutex, MutexGuard, RwLock, RwLockReadGuard, RwLockWriteGuard};
pub use std::sync::{Arc, Mutex, MutexGuard, RwLock};
pub use std::task::{Context, Poll};
pub use wasm_bindgen::prelude::*;
pub use workflow_core::prelude::*;
pub use workflow_core::seal;
pub use workflow_log::prelude::*;
pub use workflow_wasm::prelude::*;
pub use workflow_wasm::stream::AsyncStream;
pub use xxhash_rust::xxh3::xxh3_64;
pub use zeroize::*;
1 change: 0 additions & 1 deletion wallet/core/src/wallet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ use workflow_core::task::spawn;
pub mod api;
pub mod args;
pub mod maps;
pub use api::*;
pub use args::*;

#[derive(Clone)]
Expand Down

0 comments on commit a9d1f9b

Please sign in to comment.