tor-chanmgr: tests: Have unwrap_open return a (mut) reference

This avoids confusing bugs where you try to modify the result and
nothing happens!
This commit is contained in:
Ian Jackson 2022-06-14 15:06:24 +01:00
parent d95f597323
commit db4ea619f5
1 changed files with 2 additions and 2 deletions

View File

@ -70,9 +70,9 @@ impl<C: Clone> ChannelState<C> {
/// For testing: either give the Open channel inside this state,
/// or panic if there is none.
#[cfg(test)]
fn unwrap_open(&self) -> C {
fn unwrap_open(&mut self) -> &mut C {
match self {
ChannelState::Open(ent) => ent.clone().channel,
ChannelState::Open(ent) => &mut ent.channel,
_ => panic!("Not an open channel"),
}
}