proxy: remove dead code (#8847)

By marking everything possible as pub(crate), we find a few dead code
candidates.
This commit is contained in:
Conrad Ludgate
2024-08-27 12:00:35 +01:00
committed by GitHub
parent 5d527133a3
commit 12850dd5e9
73 changed files with 580 additions and 609 deletions
+5 -5
View File
@@ -3,12 +3,12 @@ use std::{error::Error as StdError, fmt, io};
use measured::FixedCardinalityLabel;
/// Upcast (almost) any error into an opaque [`io::Error`].
pub fn io_error(e: impl Into<Box<dyn StdError + Send + Sync>>) -> io::Error {
pub(crate) fn io_error(e: impl Into<Box<dyn StdError + Send + Sync>>) -> io::Error {
io::Error::new(io::ErrorKind::Other, e)
}
/// A small combinator for pluggable error logging.
pub fn log_error<E: fmt::Display>(e: E) -> E {
pub(crate) fn log_error<E: fmt::Display>(e: E) -> E {
tracing::error!("{e}");
e
}
@@ -19,7 +19,7 @@ pub fn log_error<E: fmt::Display>(e: E) -> E {
/// NOTE: This trait should not be implemented for [`anyhow::Error`], since it
/// is way too convenient and tends to proliferate all across the codebase,
/// ultimately leading to accidental leaks of sensitive data.
pub trait UserFacingError: ReportableError {
pub(crate) trait UserFacingError: ReportableError {
/// Format the error for client, stripping all sensitive info.
///
/// Although this might be a no-op for many types, it's highly
@@ -64,7 +64,7 @@ pub enum ErrorKind {
}
impl ErrorKind {
pub fn to_metric_label(&self) -> &'static str {
pub(crate) fn to_metric_label(self) -> &'static str {
match self {
ErrorKind::User => "user",
ErrorKind::ClientDisconnect => "clientdisconnect",
@@ -78,7 +78,7 @@ impl ErrorKind {
}
}
pub trait ReportableError: fmt::Display + Send + 'static {
pub(crate) trait ReportableError: fmt::Display + Send + 'static {
fn get_error_kind(&self) -> ErrorKind;
}