Skip to content

Commit

Permalink
Remove unused cfg attributes (#361)
Browse files Browse the repository at this point in the history
* Remove unused cfg attributes

* code quality: remove unused cfg attributes and fix warning
  • Loading branch information
siddheshzz authored Feb 4, 2025
1 parent f7bbd0e commit 6a073bc
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 25 deletions.
2 changes: 1 addition & 1 deletion crates/floresta-chain/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//! All data is stored in a `ChainStore` implementation, which is generic over the
//! underlying database. See the ChainStore trait for more information. For a
//! ready-to-use implementation, see the [KvChainStore] struct.
#![cfg_attr(any(feature = "no-std", not(test)), no_std)]
#![cfg_attr(not(test), no_std)]

pub mod pruned_utreexo;
pub(crate) use floresta_common::prelude;
Expand Down
2 changes: 0 additions & 2 deletions crates/floresta-chain/src/pruned_utreexo/chain_state.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
extern crate alloc;
#[cfg(not(feature = "no-std"))]
extern crate std;

use alloc::borrow::ToOwned;
use alloc::fmt::format;
Expand Down
5 changes: 0 additions & 5 deletions crates/floresta-chain/src/pruned_utreexo/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,13 @@ use core::fmt::Debug;
use bitcoin::blockdata::script;
use bitcoin::OutPoint;
use bitcoin::Txid;
#[cfg(feature = "cli-blockchain")]
use btcd_rpc::error::UtreexodError;
use floresta_common::impl_error_from;

use crate::prelude::*;
pub trait DatabaseError: Debug + Send + Sync + 'static {}
#[derive(Debug)]
pub enum BlockchainError {
BlockNotPresent,
#[cfg(feature = "cli-blockchain")]
#[error("Json-Rpc error")]
JsonRpcError(#[from] UtreexodError),
Parsing(String),
BlockValidation(BlockValidationErrors),
TransactionError(TransactionError),
Expand Down
5 changes: 0 additions & 5 deletions crates/floresta-electrum/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
#[cfg(feature = "cli-blockchain")]
use btcd_rpc::error::UtreexodError;
use thiserror::Error;

#[derive(Error, Debug)]
pub enum Error {
#[error("Utreexod error")]
#[cfg(feature = "cli-blockchain")]
BackendError(#[from] UtreexodError),
#[error("Invalid params passed in")]
InvalidParams,
#[error("Invalid json string {0}")]
Expand Down
2 changes: 0 additions & 2 deletions crates/floresta-watch-only/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// SPDX-License-Identifier: MIT

#![cfg_attr(feature = "no-std", no_std)]
use core::cmp::Ordering;
use core::fmt::Debug;

Expand Down
10 changes: 1 addition & 9 deletions florestad/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
use bitcoin::consensus::encode;
#[cfg(feature = "cli-blockchain")]
use btcd_rpc::error::UtreexodError;
use floresta_chain::BlockValidationErrors;
use floresta_chain::BlockchainError;

use crate::slip132;
#[derive(Debug)]
pub enum Error {
#[cfg(feature = "cli-blockchain")]
UtreexodError(UtreexodError),
Encode(encode::Error),
Db(kv::Error),
ParseNum(std::num::ParseIntError),
Expand All @@ -28,8 +24,6 @@ impl std::fmt::Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Error::Encode(err) => write!(f, "Encode error: {err}"),
#[cfg(feature = "cli-blockchain")]
Error::UtreexodError(_) => write!(f, "UtreexodError"),
Error::Db(err) => write!(f, "Database error {err}"),
Error::ParseNum(err) => write!(f, "int parse error: {err}"),
Error::Rustreexo(err) => write!(f, "Rustreexo error: {err}"),
Expand All @@ -56,9 +50,7 @@ macro_rules! impl_from_error {
}
};
}
// impl_from_error!(Parsing, bitcoin::hashes::hex::Error);
#[cfg(feature = "cli-blockchain")]
impl_from_error!(UtreexodError, UtreexodError);

impl_from_error!(Encode, encode::Error);
impl_from_error!(Db, kv::Error);
impl_from_error!(ParseNum, std::num::ParseIntError);
Expand Down
1 change: 0 additions & 1 deletion florestad/src/slip132.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ pub struct DefaultResolver;
derive(Serialize, Deserialize),
serde(crate = "serde_crate")
)]
#[cfg_attr(feature = "strict_encoding", derive(StrictEncode, StrictDecode))]
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug)]
#[non_exhaustive]
pub enum KeyApplication {
Expand Down

0 comments on commit 6a073bc

Please sign in to comment.