Replace manual Debug impl with std derive in tor-circmgr
When I wrote this, I arranged to skip dumping the field `pending`. This must have been because I thought that either (a) PendingEntry couldn't `#[derive(Debug)]` (but it can) and/or (b) Some of the fields of PendingEntry ought not to be dumped because they might contain (eg) packet data. But I think they don't: there's just the spec, and the Result which is (basically) a Circ. I tried preseving something closer to the original using educe, but educe gets somehow tangled up with the generics, and the result fails to compile. I haven't investigated this further.
This commit is contained in:
parent
d1e8aa1dbd
commit
90f86b47e4
|
@ -37,7 +37,7 @@ use futures::stream::{FuturesUnordered, StreamExt};
|
|||
use futures::task::SpawnExt;
|
||||
use std::collections::HashMap;
|
||||
use std::convert::TryInto;
|
||||
use std::fmt::{self, Debug};
|
||||
use std::fmt::Debug;
|
||||
use std::hash::Hash;
|
||||
use std::panic::AssertUnwindSafe;
|
||||
use std::sync::{self, Arc, Weak};
|
||||
|
@ -383,6 +383,7 @@ impl<B: AbstractCircBuilder> PendingRequest<B> {
|
|||
|
||||
/// An entry for an under-construction in-progress circuit tracked by
|
||||
/// an `AbstractCircMgr`.
|
||||
#[derive(Debug)]
|
||||
struct PendingEntry<B: AbstractCircBuilder> {
|
||||
/// Specification that this circuit will support, if every pending
|
||||
/// request that is waiting for it is attached to it.
|
||||
|
@ -448,6 +449,7 @@ impl<B: AbstractCircBuilder> PendingEntry<B> {
|
|||
|
||||
/// Wrapper type to represent the state between planning to build a
|
||||
/// circuit and constructing it.
|
||||
#[derive(Debug)]
|
||||
struct CircBuildPlan<B: AbstractCircBuilder> {
|
||||
/// The Plan object returned by [`AbstractCircBuilder::plan_circuit`].
|
||||
plan: B::Plan,
|
||||
|
@ -457,15 +459,6 @@ struct CircBuildPlan<B: AbstractCircBuilder> {
|
|||
pending: Arc<PendingEntry<B>>,
|
||||
}
|
||||
|
||||
impl<B: AbstractCircBuilder> Debug for CircBuildPlan<B> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
f.debug_struct("CircBuildPlan")
|
||||
.field("plan", &self.plan)
|
||||
.field("sender", &self.sender)
|
||||
.finish_non_exhaustive()
|
||||
}
|
||||
}
|
||||
|
||||
/// The inner state of an [`AbstractCircMgr`].
|
||||
struct CircList<B: AbstractCircBuilder> {
|
||||
/// A map from circuit ID to [`OpenEntry`] values for all managed
|
||||
|
|
Loading…
Reference in New Issue