Fix most warnings from nightly.

(One represents code that I forgot to write.)
This commit is contained in:
Nick Mathewson 2021-10-19 16:21:12 -04:00
parent fc1556461f
commit 445ec6d220
11 changed files with 24 additions and 21 deletions

View File

@ -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();

View File

@ -153,9 +153,6 @@ impl<'a> DirInfo<'a> {
pub struct CircMgr<R: Runtime> {
/// The underlying circuit manager object that implements our behavior.
mgr: Arc<mgr::AbstractCircMgr<build::CircuitBuilder<R>, R>>,
/// A handle to the state manager for recording timeout history.
storage: TimeoutStateHandle,
}
impl<R: Runtime> CircMgr<R> {
@ -179,19 +176,11 @@ impl<R: Runtime> CircMgr<R> {
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(),

View File

@ -18,6 +18,7 @@ type Result<T> = std::result::Result<T, ConfigError>;
#[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<String>,

View File

@ -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],

View File

@ -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

View File

@ -127,9 +127,10 @@ pub(crate) async fn load<R: Runtime>(
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"
);
}
}

View File

@ -287,6 +287,7 @@ struct GetCertsState<DM: WriteNetDir> {
/// 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,

View File

@ -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"?

View File

@ -225,6 +225,7 @@ pub(crate) struct PendingRequest {
/// Otherwise we run into lifetime isseus elsewhere.)
usable: Option<oneshot::Sender<bool>>,
/// 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.

View File

@ -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 {

View File

@ -68,13 +68,15 @@ struct GenericRouterStatus<D> {
///
/// 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<net::SocketAddr>,
/// 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,