mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-29 01:31:33 +00:00
chore: enforce unreachable_pub
lint
The `unreachable_pub` lint makes us aware of uses of `pub` that are not actually reachable from the crate root. This is considered good because it means reading a `pub` somewhere means it is actually public API. Some of our crates are quite large and keeping their entire API surface in your head is difficult. We should strive for most items being `pub(crate)`. This lint helps us enforce that. Pull-Request: #3735.
This commit is contained in:
@ -23,12 +23,12 @@ use prometheus_client::metrics::counter::Counter;
|
||||
use prometheus_client::metrics::family::Family;
|
||||
use prometheus_client::registry::Registry;
|
||||
|
||||
pub struct Metrics {
|
||||
pub(crate) struct Metrics {
|
||||
events: Family<EventLabels, Counter>,
|
||||
}
|
||||
|
||||
impl Metrics {
|
||||
pub fn new(registry: &mut Registry) -> Self {
|
||||
pub(crate) fn new(registry: &mut Registry) -> Self {
|
||||
let sub_registry = registry.sub_registry_with_prefix("dcutr");
|
||||
|
||||
let events = Family::default();
|
||||
|
@ -21,12 +21,12 @@
|
||||
use prometheus_client::metrics::counter::Counter;
|
||||
use prometheus_client::registry::Registry;
|
||||
|
||||
pub struct Metrics {
|
||||
pub(crate) struct Metrics {
|
||||
messages: Counter,
|
||||
}
|
||||
|
||||
impl Metrics {
|
||||
pub fn new(registry: &mut Registry) -> Self {
|
||||
pub(crate) fn new(registry: &mut Registry) -> Self {
|
||||
let sub_registry = registry.sub_registry_with_prefix("gossipsub");
|
||||
|
||||
let messages = Counter::default();
|
||||
|
@ -30,7 +30,7 @@ use std::collections::HashMap;
|
||||
use std::iter;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
pub struct Metrics {
|
||||
pub(crate) struct Metrics {
|
||||
protocols: Protocols,
|
||||
error: Counter,
|
||||
pushed: Counter,
|
||||
@ -42,7 +42,7 @@ pub struct Metrics {
|
||||
}
|
||||
|
||||
impl Metrics {
|
||||
pub fn new(registry: &mut Registry) -> Self {
|
||||
pub(crate) fn new(registry: &mut Registry) -> Self {
|
||||
let sub_registry = registry.sub_registry_with_prefix("identify");
|
||||
|
||||
let protocols = Protocols::default();
|
||||
|
@ -24,7 +24,7 @@ use prometheus_client::metrics::family::Family;
|
||||
use prometheus_client::metrics::histogram::{exponential_buckets, Histogram};
|
||||
use prometheus_client::registry::{Registry, Unit};
|
||||
|
||||
pub struct Metrics {
|
||||
pub(crate) struct Metrics {
|
||||
query_result_get_record_ok: Counter,
|
||||
query_result_get_record_error: Family<GetRecordResult, Counter>,
|
||||
|
||||
@ -45,7 +45,7 @@ pub struct Metrics {
|
||||
}
|
||||
|
||||
impl Metrics {
|
||||
pub fn new(registry: &mut Registry) -> Self {
|
||||
pub(crate) fn new(registry: &mut Registry) -> Self {
|
||||
let sub_registry = registry.sub_registry_with_prefix("kad");
|
||||
|
||||
let query_result_get_record_ok = Counter::default();
|
||||
|
@ -52,14 +52,14 @@ enum Failure {
|
||||
Other,
|
||||
}
|
||||
|
||||
pub struct Metrics {
|
||||
pub(crate) struct Metrics {
|
||||
rtt: Histogram,
|
||||
failure: Family<FailureLabels, Counter>,
|
||||
pong_received: Counter,
|
||||
}
|
||||
|
||||
impl Metrics {
|
||||
pub fn new(registry: &mut Registry) -> Self {
|
||||
pub(crate) fn new(registry: &mut Registry) -> Self {
|
||||
let sub_registry = registry.sub_registry_with_prefix("ping");
|
||||
|
||||
let rtt = Histogram::new(exponential_buckets(0.001, 2.0, 12));
|
||||
|
@ -1,6 +1,6 @@
|
||||
use libp2p_core::multiaddr::Multiaddr;
|
||||
|
||||
pub fn as_string(ma: &Multiaddr) -> String {
|
||||
pub(crate) fn as_string(ma: &Multiaddr) -> String {
|
||||
let len = ma
|
||||
.protocol_stack()
|
||||
.fold(0, |acc, proto| acc + proto.len() + 1);
|
||||
|
@ -23,12 +23,12 @@ use prometheus_client::metrics::counter::Counter;
|
||||
use prometheus_client::metrics::family::Family;
|
||||
use prometheus_client::registry::Registry;
|
||||
|
||||
pub struct Metrics {
|
||||
pub(crate) struct Metrics {
|
||||
events: Family<EventLabels, Counter>,
|
||||
}
|
||||
|
||||
impl Metrics {
|
||||
pub fn new(registry: &mut Registry) -> Self {
|
||||
pub(crate) fn new(registry: &mut Registry) -> Self {
|
||||
let sub_registry = registry.sub_registry_with_prefix("relay");
|
||||
|
||||
let events = Family::default();
|
||||
|
@ -25,7 +25,7 @@ use prometheus_client::metrics::family::Family;
|
||||
use prometheus_client::metrics::histogram::{exponential_buckets, Histogram};
|
||||
use prometheus_client::registry::Registry;
|
||||
|
||||
pub struct Metrics {
|
||||
pub(crate) struct Metrics {
|
||||
connections_incoming: Family<AddressLabels, Counter>,
|
||||
connections_incoming_error: Family<IncomingConnectionErrorLabels, Counter>,
|
||||
|
||||
@ -45,7 +45,7 @@ pub struct Metrics {
|
||||
}
|
||||
|
||||
impl Metrics {
|
||||
pub fn new(registry: &mut Registry) -> Self {
|
||||
pub(crate) fn new(registry: &mut Registry) -> Self {
|
||||
let sub_registry = registry.sub_registry_with_prefix("swarm");
|
||||
|
||||
let connections_incoming = Family::default();
|
||||
|
Reference in New Issue
Block a user