Skip to content

Commit

Permalink
Use take instead of std::mem::replace.
Browse files Browse the repository at this point in the history
Signed-off-by: ChenYing Kuo <[email protected]>
  • Loading branch information
evshary committed Oct 30, 2024
1 parent 49f8a8b commit c8b89b6
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions zenoh-plugin-ros2dds/src/route_publisher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ pub struct RoutePublisher {
impl Drop for RoutePublisher {
fn drop(&mut self) {
self.deactivate_dds_reader();
let matching_listener =
std::mem::replace(&mut self.zenoh_publisher.matching_listener, None);
let matching_listener = self.zenoh_publisher.matching_listener.take();
if let Some(matching_listener) = matching_listener {
if let Err(e) = matching_listener.undeclare().wait() {
tracing::warn!("Unable to undeclare matching_listener: {e:?}");
Expand Down

0 comments on commit c8b89b6

Please sign in to comment.