Skip to content

Commit

Permalink
Merge pull request #1504 from input-output-hk/djo/fix_clippy_warn_in_…
Browse files Browse the repository at this point in the history
…common

Fix clippy warning in common when using only `fs` flag
  • Loading branch information
Alenar committed Feb 14, 2024
2 parents 939e16e + 264bd59 commit bc142fc
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mithril-common/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "mithril-common"
version = "0.3.2"
version = "0.3.3"
description = "Common types, interfaces, and utilities for Mithril nodes."
authors = { workspace = true }
edition = { workspace = true }
Expand Down
31 changes: 14 additions & 17 deletions mithril-common/src/chain_observer/mod.rs
@@ -1,31 +1,28 @@
//! Tools to request metadata, like the current epoch or the stake distribution, from the Cardano

#[cfg(all(feature = "fs", feature = "random"))]
mod builder;
#[cfg(all(feature = "fs", feature = "random"))]
mod cli_observer;
mod interface;
mod model;
#[cfg(all(feature = "fs", feature = "random"))]
mod pallas_observer;

#[cfg(all(test, feature = "fs", feature = "random"))]
mod test_cli_runner;

#[cfg(all(feature = "fs", feature = "random"))]
pub use builder::{ChainObserverBuilder, ChainObserverType};
#[cfg(all(feature = "fs", feature = "random"))]
pub use cli_observer::CliRunner;
#[cfg(all(feature = "fs", feature = "random"))]
pub use cli_observer::{CardanoCliChainObserver, CardanoCliRunner};
#[cfg(test)]
pub use interface::MockChainObserver;
pub use interface::{ChainObserver, ChainObserverError};
pub use model::{
ChainAddress, TxDatum, TxDatumBuilder, TxDatumError, TxDatumFieldTypeName, TxDatumFieldValue,
};
#[cfg(all(feature = "fs", feature = "random"))]
pub use pallas_observer::PallasChainObserver;

cfg_fs_random! {
mod builder;
mod cli_observer;
mod pallas_observer;

#[cfg(test)]
mod test_cli_runner;

pub use builder::{ChainObserverBuilder, ChainObserverType};
pub use cli_observer::CliRunner;
pub use cli_observer::{CardanoCliChainObserver, CardanoCliRunner};
pub use pallas_observer::PallasChainObserver;
}

cfg_test_tools! {
mod fake_observer;
Expand Down
3 changes: 2 additions & 1 deletion mithril-common/src/chain_observer/model.rs
Expand Up @@ -7,11 +7,12 @@ use thiserror::Error;

use crate::{StdError, StdResult};

cfg_fs! {
cfg_fs_random! {
use serde::Deserialize;
use anyhow::Context;
use minicbor::{Decode, Decoder, decode};
use pallas_primitives::{alonzo::PlutusData, ToCanonicalJson};

/// [Datum] represents an inline datum from UTxO.
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, PartialOrd, Ord, Clone)]
#[serde(rename_all = "lowercase")]
Expand Down
10 changes: 10 additions & 0 deletions mithril-common/src/lib.rs
Expand Up @@ -30,6 +30,16 @@ macro_rules! cfg_random {
}
}

macro_rules! cfg_fs_random {
($($item:item)*) => {
$(
#[cfg(all(feature = "fs", feature = "random"))]
#[cfg_attr(docsrs, doc(all(feature = "fs", feature = "random")))]
$item
)*
}
}

macro_rules! cfg_test_tools {
($($item:item)*) => {
$(
Expand Down

0 comments on commit bc142fc

Please sign in to comment.