Skip to content

Commit 573e569

Browse files
committed
fix: warnings about never used structs
1 parent 2813c09 commit 573e569

File tree

3 files changed

+10
-38
lines changed

3 files changed

+10
-38
lines changed

mithril-aggregator/src/services/aggregator_client.rs

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -379,41 +379,6 @@ impl RemoteCertificateRetriever for AggregatorHTTPClient {
379379
}
380380
}
381381

382-
#[cfg(test)]
383-
pub(crate) mod dumb {
384-
use tokio::sync::RwLock;
385-
386-
use mithril_common::test::double::Dummy;
387-
388-
use super::*;
389-
390-
/// This aggregator client is intended to be used by test services.
391-
/// It actually does not communicate with an aggregator host but mimics this behavior.
392-
/// It is driven by a Tester that controls the data it can return, and it can return its internal state for testing.
393-
pub struct DumbAggregatorClient {
394-
epoch_settings: RwLock<Option<LeaderAggregatorEpochSettings>>,
395-
}
396-
397-
impl Default for DumbAggregatorClient {
398-
fn default() -> Self {
399-
Self {
400-
epoch_settings: RwLock::new(Some(LeaderAggregatorEpochSettings::dummy())),
401-
}
402-
}
403-
}
404-
405-
#[async_trait]
406-
impl LeaderAggregatorClient for DumbAggregatorClient {
407-
async fn retrieve_epoch_settings(
408-
&self,
409-
) -> StdResult<Option<LeaderAggregatorEpochSettings>> {
410-
let epoch_settings = self.epoch_settings.read().await.clone();
411-
412-
Ok(epoch_settings)
413-
}
414-
}
415-
}
416-
417382
#[cfg(test)]
418383
mod tests {
419384
use http::response::Builder as HttpResponseBuilder;

mithril-aggregator/src/store/epoch_settings_storer.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
#[cfg(test)]
12
use std::collections::HashMap;
23

34
use async_trait::async_trait;
45
use mithril_common::StdResult;
6+
#[cfg(test)]
57
use tokio::sync::RwLock;
68

79
use mithril_common::entities::{Epoch, ProtocolParameters};
@@ -56,18 +58,20 @@ pub trait EpochSettingsStorer:
5658
}
5759
}
5860

61+
#[cfg(test)]
5962
pub struct FakeEpochSettingsStorer {
6063
pub epoch_settings: RwLock<HashMap<Epoch, AggregatorEpochSettings>>,
6164
}
6265

66+
#[cfg(test)]
6367
impl FakeEpochSettingsStorer {
64-
#[cfg(test)]
6568
pub fn new(data: Vec<(Epoch, AggregatorEpochSettings)>) -> Self {
6669
let epoch_settings = RwLock::new(data.into_iter().collect());
6770
Self { epoch_settings }
6871
}
6972
}
7073

74+
#[cfg(test)]
7175
#[async_trait]
7276
impl ProtocolParametersRetriever for FakeEpochSettingsStorer {
7377
async fn get_protocol_parameters(&self, epoch: Epoch) -> StdResult<Option<ProtocolParameters>> {
@@ -78,6 +82,7 @@ impl ProtocolParametersRetriever for FakeEpochSettingsStorer {
7882
}
7983
}
8084

85+
#[cfg(test)]
8186
#[async_trait]
8287
impl EpochSettingsStorer for FakeEpochSettingsStorer {
8388
async fn save_epoch_settings(
@@ -97,6 +102,7 @@ impl EpochSettingsStorer for FakeEpochSettingsStorer {
97102
}
98103
}
99104

105+
#[cfg(test)]
100106
#[async_trait]
101107
impl EpochPruningTask for FakeEpochSettingsStorer {
102108
fn pruned_data(&self) -> &'static str {

mithril-aggregator/src/tools/file_archiver/appender.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,19 @@ pub trait TarAppender: Send {
2424
}
2525
}
2626

27+
#[cfg(test)]
2728
pub struct AppenderDirAll {
2829
target_directory: PathBuf,
2930
}
30-
31+
#[cfg(test)]
3132
impl AppenderDirAll {
3233
// Note: Not used anymore outside of tests but useful tool to keep around if we ever need to archive a directory
33-
#[cfg(test)]
3434
pub fn new(target_directory: PathBuf) -> Self {
3535
Self { target_directory }
3636
}
3737
}
3838

39+
#[cfg(test)]
3940
impl TarAppender for AppenderDirAll {
4041
fn append<T: Write>(&self, tar: &mut tar::Builder<T>) -> StdResult<()> {
4142
tar.append_dir_all(".", &self.target_directory).with_context(|| {

0 commit comments

Comments
 (0)