From db4ea619f5dfa332bfbab0e981e1bea91df7c31b Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 14 Jun 2022 15:06:24 +0100 Subject: [PATCH] tor-chanmgr: tests: Have unwrap_open return a (mut) reference This avoids confusing bugs where you try to modify the result and nothing happens! --- crates/tor-chanmgr/src/mgr/map.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/tor-chanmgr/src/mgr/map.rs b/crates/tor-chanmgr/src/mgr/map.rs index 7694b648a..bdc775538 100644 --- a/crates/tor-chanmgr/src/mgr/map.rs +++ b/crates/tor-chanmgr/src/mgr/map.rs @@ -70,9 +70,9 @@ impl ChannelState { /// 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"), } }