diff --git a/crates/arti/src/main.rs b/crates/arti/src/main.rs index 97adea84f..af61175bf 100644 --- a/crates/arti/src/main.rs +++ b/crates/arti/src/main.rs @@ -272,12 +272,14 @@ fn setup_logging(config: &ArtiConfig) { let registry = registry().with(fmt::Layer::default()).with(env_filter); - #[cfg(feature = "journald")] if config.logging.journald { + #[cfg(feature = "journald")] if let Ok(journald) = tracing_journald::layer() { registry.with(journald).init(); return; } + #[cfg(not(feature = "journald"))] + warn!("journald logging was selected, but arti was built without journald support."); } registry.init(); diff --git a/crates/tor-circmgr/src/lib.rs b/crates/tor-circmgr/src/lib.rs index 480cb7aeb..3b9150664 100644 --- a/crates/tor-circmgr/src/lib.rs +++ b/crates/tor-circmgr/src/lib.rs @@ -153,9 +153,6 @@ impl<'a> DirInfo<'a> { pub struct CircMgr { /// The underlying circuit manager object that implements our behavior. mgr: Arc, R>>, - - /// A handle to the state manager for recording timeout history. - storage: TimeoutStateHandle, } impl CircMgr { @@ -179,19 +176,11 @@ impl CircMgr { let storage = storage.create_handle(PARETO_TIMEOUT_DATA_KEY); - let builder = build::CircuitBuilder::new( - runtime.clone(), - chanmgr, - path_config, - Arc::clone(&storage), - guardmgr, - ); + let builder = + build::CircuitBuilder::new(runtime.clone(), chanmgr, path_config, storage, guardmgr); let mgr = mgr::AbstractCircMgr::new(builder, runtime.clone(), request_timing, circuit_timing); - let circmgr = Arc::new(CircMgr { - mgr: Arc::new(mgr), - storage, - }); + let circmgr = Arc::new(CircMgr { mgr: Arc::new(mgr) }); runtime.spawn(continually_expire_circuits( runtime.clone(), diff --git a/crates/tor-config/src/cmdline.rs b/crates/tor-config/src/cmdline.rs index c376c2dc6..5e1a6b35f 100644 --- a/crates/tor-config/src/cmdline.rs +++ b/crates/tor-config/src/cmdline.rs @@ -18,6 +18,7 @@ type Result = std::result::Result; #[derive(Debug, Clone)] pub struct CmdLine { /// String for decorating Values. (XXXX not yet used). + #[allow(dead_code)] name: String, /// List of toml lines as given on the command line. contents: Vec, diff --git a/crates/tor-consdiff/src/lib.rs b/crates/tor-consdiff/src/lib.rs index 34e345ad1..3713a4553 100644 --- a/crates/tor-consdiff/src/lib.rs +++ b/crates/tor-consdiff/src/lib.rs @@ -184,6 +184,7 @@ enum DiffCommand<'a> { #[derive(Clone, Debug)] pub struct DiffResult<'a> { /// An expected digest of the input, before the digest is computed. + #[allow(dead_code)] // XXXX Check this value before applying the digest? d_pre: [u8; 32], /// An expected digest of the output, after it has been assembled. d_post: [u8; 32], diff --git a/crates/tor-dirmgr/src/authority.rs b/crates/tor-dirmgr/src/authority.rs index bd104e2bc..2343cc327 100644 --- a/crates/tor-dirmgr/src/authority.rs +++ b/crates/tor-dirmgr/src/authority.rs @@ -32,6 +32,10 @@ impl Authority { pub fn builder() -> AuthorityBuilder { AuthorityBuilder::default() } + /// Return the (human-readable) name for this authority. + pub fn name(&self) -> &str { + self.name.as_ref() + } /// Return the v3 identity key of this certificate. /// /// This is the identity of the >=2048-bit RSA key that the diff --git a/crates/tor-dirmgr/src/bootstrap.rs b/crates/tor-dirmgr/src/bootstrap.rs index 7af4af4f5..d8096edf4 100644 --- a/crates/tor-dirmgr/src/bootstrap.rs +++ b/crates/tor-dirmgr/src/bootstrap.rs @@ -127,9 +127,10 @@ pub(crate) async fn load( break; } safety_counter += 1; - if safety_counter == 100 { - panic!("Spent 100 iterations in the same state: this is a bug"); - } + assert!( + safety_counter < 100, + "Spent 100 iterations in the same state: this is a bug" + ); } } diff --git a/crates/tor-dirmgr/src/state.rs b/crates/tor-dirmgr/src/state.rs index 4f47a45d3..e71e45eb3 100644 --- a/crates/tor-dirmgr/src/state.rs +++ b/crates/tor-dirmgr/src/state.rs @@ -287,6 +287,7 @@ struct GetCertsState { /// The cache usage we had in mind when we began. Used to reset. cache_usage: CacheUsage, /// True iff we loaded the consensus from our cache. + #[allow(dead_code)] from_cache: bool, /// The consensus that we are trying to validate. unvalidated: UnvalidatedMdConsensus, diff --git a/crates/tor-guardmgr/src/lib.rs b/crates/tor-guardmgr/src/lib.rs index 04a9cc794..cbe0082ee 100644 --- a/crates/tor-guardmgr/src/lib.rs +++ b/crates/tor-guardmgr/src/lib.rs @@ -701,6 +701,7 @@ struct GuardParams { /// After how much time without successful activity does a /// successful circuit indicate that we should retry our primary /// guards? + #[allow(dead_code)] // XXXX not yet implemented. internet_down_timeout: Duration, /// What fraction of the guards can be can be filtered out before we /// decide that our filter is "very restrictive"? diff --git a/crates/tor-guardmgr/src/pending.rs b/crates/tor-guardmgr/src/pending.rs index fbdce2ce7..389a5aee9 100644 --- a/crates/tor-guardmgr/src/pending.rs +++ b/crates/tor-guardmgr/src/pending.rs @@ -225,6 +225,7 @@ pub(crate) struct PendingRequest { /// Otherwise we run into lifetime isseus elsewhere.) usable: Option>, /// The time when we gave out this guard. + #[allow(dead_code)] // TODO: Remove, or use it to notice stuck requests started_at: Instant, /// The time at which the circuit manager told us that this guard was /// successful. diff --git a/crates/tor-netdoc/src/doc/netstatus.rs b/crates/tor-netdoc/src/doc/netstatus.rs index 03e7aeb8b..526c601fe 100644 --- a/crates/tor-netdoc/src/doc/netstatus.rs +++ b/crates/tor-netdoc/src/doc/netstatus.rs @@ -904,12 +904,12 @@ impl ConsensusHeader { let shared_rand_prev = sec .get(SHARED_RAND_PREVIOUS_VALUE) - .map(|i| SharedRandVal::from_item(i)) + .map(SharedRandVal::from_item) .transpose()?; let shared_rand_cur = sec .get(SHARED_RAND_CURRENT_VALUE) - .map(|i| SharedRandVal::from_item(i)) + .map(SharedRandVal::from_item) .transpose()?; Ok(ConsensusHeader { diff --git a/crates/tor-netdoc/src/doc/netstatus/rs.rs b/crates/tor-netdoc/src/doc/netstatus/rs.rs index 735dfe2af..34ad32dbc 100644 --- a/crates/tor-netdoc/src/doc/netstatus/rs.rs +++ b/crates/tor-netdoc/src/doc/netstatus/rs.rs @@ -68,13 +68,15 @@ struct GenericRouterStatus { /// /// This value should be ignored for all purposes; see /// [proposal 275](https://gitlab.torproject.org/tpo/core/torspec/-/blob/master/proposals/275-md-published-time-is-silly.txt). - // TODO: so why not remove this? + #[allow(dead_code)] // TODO: remove this some day? published: time::SystemTime, /// A list of address:port values where this relay can be reached. addrs: Vec, /// Declared OR port for this relay. + #[allow(dead_code)] // This value is never used; we look at addrs instead. or_port: u16, /// Declared directory port for this relay. + #[allow(dead_code)] // Arti doesn't use this value. dir_port: u16, /// Digest of the document for this relay. doc_digest: D,