diff --git a/rclrs/src/lib.rs b/rclrs/src/lib.rs index 2c9c812e7..79d19561d 100644 --- a/rclrs/src/lib.rs +++ b/rclrs/src/lib.rs @@ -46,7 +46,7 @@ pub use wait::*; /// /// [1]: crate::RclReturnCode pub fn spin_once(node: &Node, timeout: Option) -> Result<(), RclrsError> { - let mut wait_set = WaitSet::new_for_node(node)?; + let wait_set = WaitSet::new_for_node(node)?; let ready_entities = wait_set.wait(timeout)?; for ready_subscription in ready_entities.subscriptions { diff --git a/rclrs/src/wait.rs b/rclrs/src/wait.rs index 09284ed75..61bde77b2 100644 --- a/rclrs/src/wait.rs +++ b/rclrs/src/wait.rs @@ -321,7 +321,7 @@ impl WaitSet { /// This list is not comprehensive, since further errors may occur in the `rmw` or `rcl` layers. /// /// [1]: std::time::Duration::ZERO - pub fn wait(&mut self, timeout: Option) -> Result { + pub fn wait(mut self, timeout: Option) -> Result { let timeout_ns = match timeout.map(|d| d.as_nanos()) { None => -1, Some(ns) if ns <= i64::MAX as u128 => ns as i64,