Browse Source

Fix clippy warnings

tags/v0.2.5-alpha.2
Yuma Hiramatsu 4 years ago
parent
commit
351b7aec3a
3 changed files with 6 additions and 6 deletions
  1. +3
    -3
      rclrust/src/executor.rs
  2. +2
    -2
      rclrust/src/node.rs
  3. +1
    -1
      rclrust/src/timer.rs

+ 3
- 3
rclrust/src/executor.rs View File

@@ -8,7 +8,7 @@ use crate::error::RclRustError;
use crate::node::Node;
use crate::wait_set::RclWaitSet;

pub fn spin<'ctx>(node: &Arc<Node<'ctx>>) -> Result<()> {
pub fn spin(node: &Arc<Node<'_>>) -> Result<()> {
let mut exec = SingleThreadExecutor::new(node.context_ref())?;
exec.add_node(node);
exec.spin()?;
@@ -16,7 +16,7 @@ pub fn spin<'ctx>(node: &Arc<Node<'ctx>>) -> Result<()> {
Ok(())
}

pub fn spin_some<'ctx>(node: &Arc<Node<'ctx>>) -> Result<()> {
pub fn spin_some(node: &Arc<Node<'_>>) -> Result<()> {
let mut exec = SingleThreadExecutor::new(node.context_ref())?;
exec.add_node(node);
exec.spin_some(Duration::ZERO)?;
@@ -30,7 +30,7 @@ pub struct SingleThreadExecutor<'ctx> {
}

impl<'ctx> SingleThreadExecutor<'ctx> {
pub fn new(context: &'ctx Context) -> Result<Self> {
pub const fn new(context: &'ctx Context) -> Result<Self> {
Ok(Self {
context,
nodes: Vec::new(),


+ 2
- 2
rclrust/src/node.rs View File

@@ -132,7 +132,7 @@ impl<'ctx> Node<'ctx> {
Arc::clone(&self.handle)
}

pub(crate) fn context_ref(&self) -> &'ctx Context {
pub(crate) const fn context_ref(&self) -> &'ctx Context {
self.context
}

@@ -274,7 +274,7 @@ impl<'ctx> Node<'ctx> {
pub(crate) fn add_to_wait_set(&self, wait_set: &mut RclWaitSet) -> Result<()> {
for subscription in self.subscriptions.lock().unwrap().iter() {
if let Some(subscription) = subscription.upgrade() {
wait_set.add_subscription(&subscription.handle())?;
wait_set.add_subscription(subscription.handle())?;
}
}
for timer in self.timers.lock().unwrap().iter() {


+ 1
- 1
rclrust/src/timer.rs View File

@@ -100,7 +100,7 @@ impl<'ctx> Timer {
}))
}

pub(crate) fn handle(&self) -> &Mutex<RclTimer> {
pub(crate) const fn handle(&self) -> &Mutex<RclTimer> {
&self.handle
}



Loading…
Cancel
Save