Skip to content

Commit ac455a6

Browse files
committed
fix: address 'missing doc' clippy warning on public but test only symbols
by adjusting their visibility so they're at most `pub(crate)`. Note: With rust `1.83` there's no more 'missing doc' exception for `cfg(test)` and `pub` symbols.
1 parent 7420062 commit ac455a6

File tree

21 files changed

+29
-34
lines changed

21 files changed

+29
-34
lines changed

internal/mithril-metric/src/helper.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,13 @@ macro_rules! build_metrics_service {
8888
}
8989

9090
#[cfg(test)]
91-
pub mod test_tools {
91+
pub(crate) mod test_tools {
9292
use std::{io, sync::Arc};
9393

9494
use slog::{Drain, Logger};
9595
use slog_async::Async;
9696
use slog_term::{CompactFormat, PlainDecorator};
97+
9798
pub struct TestLogger;
9899

99100
impl TestLogger {

internal/mithril-metric/src/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,3 @@ mod server;
1010
pub use metric::*;
1111
pub use server::MetricsServer;
1212
pub use server::MetricsServiceExporter;
13-
14-
#[cfg(test)]
15-
pub use helper::test_tools::TestLogger;

internal/mithril-persistence/src/database/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub use version_checker::{DatabaseVersionChecker, SqlMigration};
1717
pub type DbVersion = i64;
1818

1919
#[cfg(test)]
20-
pub mod test_helper {
20+
pub(crate) mod test_helper {
2121
use sqlite::ConnectionThreadSafe;
2222

2323
use mithril_common::StdResult;

internal/mithril-persistence/src/sqlite/condition.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,9 +362,10 @@ mod tests {
362362

363363
#[test]
364364
fn expression_get_all_default() {
365-
impl GetAllCondition for String {}
365+
struct Expression;
366+
impl GetAllCondition for Expression {}
366367

367-
let expression = String::get_all_condition();
368+
let expression = Expression::get_all_condition();
368369
let (sql, params) = expression.expand();
369370

370371
assert_eq!("true".to_string(), sql);

mithril-aggregator/src/database/record/certificate.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,15 @@ pub struct CertificateRecord {
6969

7070
#[cfg(test)]
7171
impl CertificateRecord {
72-
pub fn dummy_genesis(id: &str, epoch: Epoch) -> Self {
72+
pub(crate) fn dummy_genesis(id: &str, epoch: Epoch) -> Self {
7373
Self {
7474
parent_certificate_id: None,
7575
signature: fake_keys::genesis_signature()[0].to_owned(),
7676
..Self::dummy(id, "", epoch, SignedEntityType::genesis(epoch))
7777
}
7878
}
7979

80-
pub fn dummy_db_snapshot(
80+
pub(crate) fn dummy_db_snapshot(
8181
id: &str,
8282
parent_id: &str,
8383
epoch: Epoch,
@@ -94,7 +94,7 @@ impl CertificateRecord {
9494
)
9595
}
9696

97-
pub fn dummy_msd(id: &str, parent_id: &str, epoch: Epoch) -> Self {
97+
pub(crate) fn dummy_msd(id: &str, parent_id: &str, epoch: Epoch) -> Self {
9898
Self::dummy(
9999
id,
100100
parent_id,
@@ -103,7 +103,7 @@ impl CertificateRecord {
103103
)
104104
}
105105

106-
pub fn dummy(
106+
pub(crate) fn dummy(
107107
id: &str,
108108
parent_id: &str,
109109
epoch: Epoch,

mithril-aggregator/src/dependency_injection/containers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ impl DependencyContainer {
303303
}
304304

305305
#[cfg(test)]
306-
pub mod tests {
306+
pub(crate) mod tests {
307307
use crate::{dependency_injection::DependenciesBuilder, Configuration, DependencyContainer};
308308

309309
pub async fn initialize_dependencies() -> DependencyContainer {

mithril-aggregator/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ pub use tools::{
6161
};
6262

6363
#[cfg(test)]
64-
pub use dependency_injection::tests::initialize_dependencies;
64+
pub(crate) use dependency_injection::tests::initialize_dependencies;
6565

6666
// Memory allocator (to handle properly memory fragmentation)
6767
#[cfg(all(not(target_env = "msvc"), feature = "jemallocator"))]

mithril-aggregator/src/services/cardano_transactions_importer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ mod tests {
251251
}
252252

253253
impl CardanoTransactionsImporter {
254-
pub fn new_for_test(
254+
pub(crate) fn new_for_test(
255255
scanner: Arc<dyn BlockScanner>,
256256
transaction_store: Arc<dyn TransactionStore>,
257257
) -> Self {

mithril-aggregator/src/services/epoch_service.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ impl EpochService for MithrilEpochService {
516516
}
517517

518518
#[cfg(test)]
519-
pub struct FakeEpochService {
519+
pub(crate) struct FakeEpochService {
520520
epoch_data: Option<EpochData>,
521521
computed_epoch_data: Option<ComputedEpochData>,
522522
inform_epoch_error: bool,
@@ -525,7 +525,7 @@ pub struct FakeEpochService {
525525
}
526526

527527
#[cfg(test)]
528-
pub struct FakeEpochServiceBuilder {
528+
pub(crate) struct FakeEpochServiceBuilder {
529529
pub cardano_era: CardanoEra,
530530
pub mithril_era: SupportedEra,
531531
pub epoch: Epoch,
@@ -662,6 +662,7 @@ impl FakeEpochService {
662662
}
663663
}
664664

665+
#[allow(dead_code)]
665666
pub fn toggle_errors(
666667
&mut self,
667668
inform_epoch: bool,

mithril-aggregator/src/signer_registerer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ pub struct SignerRegistrationRound {
6363

6464
#[cfg(test)]
6565
impl SignerRegistrationRound {
66-
pub fn dummy(epoch: Epoch, stake_distribution: StakeDistribution) -> Self {
66+
pub(crate) fn dummy(epoch: Epoch, stake_distribution: StakeDistribution) -> Self {
6767
Self {
6868
epoch,
6969
stake_distribution,
@@ -146,7 +146,7 @@ impl MithrilSignerRegisterer {
146146
}
147147

148148
#[cfg(test)]
149-
pub async fn get_current_round(&self) -> Option<SignerRegistrationRound> {
149+
pub(crate) async fn get_current_round(&self) -> Option<SignerRegistrationRound> {
150150
self.current_round.read().await.as_ref().cloned()
151151
}
152152
}

0 commit comments

Comments
 (0)