aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Jackson <iwj@torproject.org>2024-04-25 15:02:47 +0000
committerIan Jackson <iwj@torproject.org>2024-04-25 15:02:47 +0000
commitfd0f03eb28fb76d29e19960039a40857d16996cb (patch)
treeea2568af2b31e4ff894a1ad93fa7dafd121f6b9f
parentdb1ed00c0f7f3f3d22d6cd9da97844906a2e0edf (diff)
parentcae1a320027aefbbcefcccabd18fba11f5ecfba6 (diff)
downloadarti-fd0f03eb28fb76d29e19960039a40857d16996cb.tar.gz
arti-fd0f03eb28fb76d29e19960039a40857d16996cb.zip
Merge branch 'dead' into 'main'
Fix dead code warnings with Rust beta See merge request tpo/core/arti!2098
-rw-r--r--crates/arti-rpcserver/src/connection/auth.rs1
-rw-r--r--crates/tor-dirmgr/src/storage.rs3
-rw-r--r--crates/tor-dirmgr/src/storage/sqlite.rs1
-rw-r--r--crates/tor-keymgr/src/key_specifier/derive.rs9
-rw-r--r--crates/tor-proto/src/circuit/sendme.rs1
-rw-r--r--crates/tor-proto/src/crypto/cell.rs1
-rw-r--r--crates/tor-proto/src/crypto/handshake.rs1
-rw-r--r--crates/tor-rtmock/src/task.rs1
8 files changed, 9 insertions, 9 deletions
diff --git a/crates/arti-rpcserver/src/connection/auth.rs b/crates/arti-rpcserver/src/connection/auth.rs
index bcbd60458..bc807e566 100644
--- a/crates/arti-rpcserver/src/connection/auth.rs
+++ b/crates/arti-rpcserver/src/connection/auth.rs
@@ -155,6 +155,7 @@ impl rpc::Method for Authenticate {
/// An error during authentication.
#[derive(Debug, Clone, thiserror::Error, serde::Serialize)]
+#[allow(dead_code)] // TODO RPC
enum AuthenticationFailure {}
impl tor_error::HasKind for AuthenticationFailure {
diff --git a/crates/tor-dirmgr/src/storage.rs b/crates/tor-dirmgr/src/storage.rs
index 834c7814e..e52cbcd4b 100644
--- a/crates/tor-dirmgr/src/storage.rs
+++ b/crates/tor-dirmgr/src/storage.rs
@@ -263,6 +263,7 @@ pub(crate) trait Store: Send + 'static {
/// including its valid-after time and digest.
fn latest_consensus_meta(&self, flavor: ConsensusFlavor) -> Result<Option<ConsensusMeta>>;
/// Try to read the consensus corresponding to the provided metadata object.
+ #[cfg(test)]
fn consensus_by_meta(&self, cmeta: &ConsensusMeta) -> Result<InputString>;
/// Try to read the consensus whose SHA3-256 digests is the provided
/// value, and its metadata.
@@ -281,6 +282,7 @@ pub(crate) trait Store: Send + 'static {
/// Mark the consensus generated from `cmeta` as no longer pending.
fn mark_consensus_usable(&mut self, cmeta: &ConsensusMeta) -> Result<()>;
/// Remove the consensus generated from `cmeta`.
+ #[allow(dead_code)] // TODO #1383 do we want to keep this anyway
fn delete_consensus(&mut self, cmeta: &ConsensusMeta) -> Result<()>;
/// Read all of the specified authority certs from the cache.
@@ -328,6 +330,7 @@ pub(crate) trait Store: Send + 'static {
///
/// It's not an error if it's not present.
#[cfg(feature = "bridge-client")]
+ #[allow(dead_code)] // TODO #1383 is lack of call sites indication of a bug?
fn delete_bridgedesc(&mut self, bridge: &BridgeConfig) -> Result<()>;
}
diff --git a/crates/tor-dirmgr/src/storage/sqlite.rs b/crates/tor-dirmgr/src/storage/sqlite.rs
index 343be00a7..d9a38145a 100644
--- a/crates/tor-dirmgr/src/storage/sqlite.rs
+++ b/crates/tor-dirmgr/src/storage/sqlite.rs
@@ -381,6 +381,7 @@ impl Store for SqliteStore {
Ok(None)
}
}
+ #[cfg(test)]
fn consensus_by_meta(&self, cmeta: &ConsensusMeta) -> Result<InputString> {
if let Some((text, _)) =
self.consensus_by_sha3_digest_of_signed_part(cmeta.sha3_256_of_signed())?
diff --git a/crates/tor-keymgr/src/key_specifier/derive.rs b/crates/tor-keymgr/src/key_specifier/derive.rs
index d7c495b9c..f14ec8d5d 100644
--- a/crates/tor-keymgr/src/key_specifier/derive.rs
+++ b/crates/tor-keymgr/src/key_specifier/derive.rs
@@ -267,15 +267,6 @@ pub fn parse_key_path(
Ok(())
}
-/// Wrapper for `KeySpecifierComponent` that `Displays` via `fmt_pretty`
-struct KeySpecifierComponentPrettyHelper<'c>(&'c dyn KeySpecifierComponent);
-
-impl Display for KeySpecifierComponentPrettyHelper<'_> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- KeySpecifierComponent::fmt_pretty(self.0, f)
- }
-}
-
/// Build a `KeyPathInfo` given the information about a key specifier
///
/// Calling pattern, to minimise macro-generated machine code,
diff --git a/crates/tor-proto/src/circuit/sendme.rs b/crates/tor-proto/src/circuit/sendme.rs
index 691e87d57..c7e0ab2b6 100644
--- a/crates/tor-proto/src/circuit/sendme.rs
+++ b/crates/tor-proto/src/circuit/sendme.rs
@@ -81,6 +81,7 @@ where
/// Helper: parametrizes a window to determine its maximum and its increment.
pub(crate) trait WindowParams {
/// Largest allowable value for this window.
+ #[allow(dead_code)] // TODO #1383 failure to ever use this is probably a bug
fn maximum() -> u16;
/// Increment for this window.
fn increment() -> u16;
diff --git a/crates/tor-proto/src/crypto/cell.rs b/crates/tor-proto/src/crypto/cell.rs
index 0cbc96db7..55ce46017 100644
--- a/crates/tor-proto/src/crypto/cell.rs
+++ b/crates/tor-proto/src/crypto/cell.rs
@@ -82,6 +82,7 @@ where
}
/// Represents a relay's view of the crypto state on a given circuit.
+#[allow(dead_code)] // TODO #1383 ????
pub(crate) trait RelayCrypt {
/// Prepare a RelayCellBody to be sent towards the client.
fn originate(&mut self, cell: &mut RelayCellBody);
diff --git a/crates/tor-proto/src/crypto/handshake.rs b/crates/tor-proto/src/crypto/handshake.rs
index 5d2eb01dc..b6e3da0ee 100644
--- a/crates/tor-proto/src/crypto/handshake.rs
+++ b/crates/tor-proto/src/crypto/handshake.rs
@@ -101,6 +101,7 @@ pub(crate) trait ServerHandshake {
///
/// On success, return a key generator and a server handshake message
/// to send in reply.
+ #[allow(dead_code)] // TODO #1383 ????
fn server<R: RngCore + CryptoRng, REPLY: AuxDataReply<Self>, T: AsRef<[u8]>>(
rng: &mut R,
reply_fn: &mut REPLY,
diff --git a/crates/tor-rtmock/src/task.rs b/crates/tor-rtmock/src/task.rs
index a4d8aa3c0..c352dbd8e 100644
--- a/crates/tor-rtmock/src/task.rs
+++ b/crates/tor-rtmock/src/task.rs
@@ -605,6 +605,7 @@ impl Drop for ProgressUntilStalledFuture {
//---------- ancillary and convenience functions ----------
/// Trait to let us assert at compile time that something is nicely `Sync` etc.
+#[allow(dead_code)] // yes, we don't *use* anything from this trait
trait EnsureSyncSend: Sync + Send + 'static {}
impl EnsureSyncSend for ActualWaker {}
impl EnsureSyncSend for MockExecutor {}