Remove dead_code annotations and add #[non_exhaustive] to public enums

All #[allow(dead_code)] annotations on now-used items have been removed
(acceptor.rs, acme.rs, config.rs, static_config.rs). #[non_exhaustive]
added to TlsMode, ProxyError, AdminSocketError, and ValidationError
with wildcard match arms in main.rs for the non-exhaustive enums.
This commit is contained in:
2026-06-12 05:12:32 +00:00
parent 516efb0403
commit cbcd746c9f
8 changed files with 11 additions and 19 deletions

View File

@@ -12,7 +12,6 @@ use crate::shutdown::GracefulShutdown;
const ACME_TLS_ALPN_01: &[u8] = b"acme-tls/1";
#[allow(dead_code)]
fn build_acme_server_config(
resolver: Arc<rustls_acme::ResolvesServerCertAcme>,
) -> Result<Arc<ServerConfig>> {
@@ -31,8 +30,8 @@ fn build_acme_server_config(
Ok(Arc::new(config))
}
#[allow(dead_code)]
#[derive(Debug)]
#[non_exhaustive]
pub enum TlsMode {
Manual(Arc<ServerConfig>),
Acme {
@@ -41,7 +40,6 @@ pub enum TlsMode {
},
}
#[allow(dead_code)]
pub fn setup_tls(tls_config: &TlsConfig, shutdown: Arc<GracefulShutdown>) -> Result<TlsMode> {
match tls_config.mode.as_str() {
"manual" => {

View File

@@ -8,13 +8,10 @@ use tracing::{error, info, warn};
use crate::shutdown::GracefulShutdown;
#[allow(dead_code)]
const LETS_ENCRYPT_PRODUCTION_DIRECTORY: &str = "https://acme-v02.api.letsencrypt.org/directory";
#[allow(dead_code)]
const LETS_ENCRYPT_STAGING_DIRECTORY: &str =
"https://acme-staging-v02.api.letsencrypt.org/directory";
#[allow(dead_code)]
pub struct AcmeTlsConfig {
pub domains: Vec<String>,
pub cache_dir: PathBuf,
@@ -22,7 +19,6 @@ pub struct AcmeTlsConfig {
pub contact: Vec<String>,
}
#[allow(dead_code)]
pub struct AcmeTlsSetup {
pub resolver: Arc<ResolvesServerCertAcme>,
pub state: AcmeState<std::io::Error, std::io::Error>,
@@ -54,7 +50,6 @@ impl AcmeTlsConfig {
Ok(AcmeTlsSetup { resolver, state })
}
#[allow(dead_code)]
pub fn directory_url(&self) -> &str {
match self.directory.as_str() {
"production" => LETS_ENCRYPT_PRODUCTION_DIRECTORY,
@@ -64,7 +59,6 @@ impl AcmeTlsConfig {
}
}
#[allow(dead_code)]
pub fn spawn_acme_state(
state: AcmeState<std::io::Error, std::io::Error>,
domains: Vec<String>,

View File

@@ -14,7 +14,6 @@ use rustls::ServerConfig;
use rustls::SupportedCipherSuite;
use rustls_pemfile;
#[allow(dead_code)]
static RESTRICTED_CIPHER_SUITES: &[SupportedCipherSuite] = &[
cipher_suite::TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
cipher_suite::TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,