Skip to content

Commit 4dc88b1

Browse files
committed
Run rustfmt
Signed-off-by: Michael X. Grey <[email protected]>
1 parent 2adcf3e commit 4dc88b1

File tree

10 files changed

+24
-39
lines changed

10 files changed

+24
-39
lines changed

rclrs/src/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rosidl_runtime_rs::Message;
99

1010
use crate::error::{RclReturnCode, ToResult};
1111
use crate::MessageCow;
12-
use crate::{rcl_bindings::*, RclrsError, NodeHandle, ENTITY_LIFECYCLE_MUTEX};
12+
use crate::{rcl_bindings::*, NodeHandle, RclrsError, ENTITY_LIFECYCLE_MUTEX};
1313

1414
// SAFETY: The functions accessing this type, including drop(), shouldn't care about the thread
1515
// they are running in. Therefore, this type can be safely sent to another thread.

rclrs/src/context.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ impl Context {
9090
/// assert_eq!(context.domain_id(), 5);
9191
/// ````
9292
pub fn new_with_options(
93-
args: impl IntoIterator<Item=String>,
93+
args: impl IntoIterator<Item = String>,
9494
options: InitOptions,
9595
) -> Result<Self, RclrsError> {
9696
// SAFETY: Getting a zero-initialized value is always safe
@@ -135,7 +135,7 @@ impl Context {
135135
Ok(Self {
136136
handle: Arc::new(ContextHandle {
137137
rcl_context: Mutex::new(rcl_context),
138-
})
138+
}),
139139
})
140140
}
141141

@@ -150,7 +150,7 @@ impl Context {
150150
let ret = unsafe {
151151
rcl_context_get_domain_id(
152152
&mut *self.handle.rcl_context.lock().unwrap(),
153-
&mut domain_id
153+
&mut domain_id,
154154
)
155155
};
156156

rclrs/src/executor.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ impl SingleThreadedExecutor {
4242
for node in { self.nodes_mtx.lock().unwrap() }
4343
.iter()
4444
.filter_map(Weak::upgrade)
45-
.filter(|node| unsafe { rcl_context_is_valid(&*node.handle.context_handle.rcl_context.lock().unwrap()) })
45+
.filter(|node| unsafe {
46+
rcl_context_is_valid(&*node.handle.context_handle.rcl_context.lock().unwrap())
47+
})
4648
{
4749
let wait_set = WaitSet::new_for_node(&node)?;
4850
let ready_entities = wait_set.wait(timeout)?;

rclrs/src/node.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ pub use self::builder::*;
1313
pub use self::graph::*;
1414
use crate::rcl_bindings::*;
1515
use crate::{
16-
Client, ClientBase, Clock, Context, ENTITY_LIFECYCLE_MUTEX, GuardCondition, ParameterBuilder, ParameterInterface,
17-
ParameterVariant, Parameters, Publisher, QoSProfile, RclrsError, Service, ServiceBase,
18-
Subscription, SubscriptionBase, SubscriptionCallback, TimeSource, ContextHandle,
16+
Client, ClientBase, Clock, Context, ContextHandle, GuardCondition, ParameterBuilder,
17+
ParameterInterface, ParameterVariant, Parameters, Publisher, QoSProfile, RclrsError, Service,
18+
ServiceBase, Subscription, SubscriptionBase, SubscriptionCallback, TimeSource,
19+
ENTITY_LIFECYCLE_MUTEX,
1920
};
2021

2122
// SAFETY: The functions accessing this type, including drop(), shouldn't care about the thread
@@ -257,11 +258,7 @@ impl Node {
257258
where
258259
T: Message,
259260
{
260-
let publisher = Arc::new(Publisher::<T>::new(
261-
Arc::clone(&self.handle),
262-
topic,
263-
qos,
264-
)?);
261+
let publisher = Arc::new(Publisher::<T>::new(Arc::clone(&self.handle), topic, qos)?);
265262
Ok(publisher)
266263
}
267264

rclrs/src/node/builder.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ use std::sync::{Arc, Mutex};
33

44
use crate::rcl_bindings::*;
55
use crate::{
6-
ClockType, Context, ContextHandle, ENTITY_LIFECYCLE_MUTEX, Node, NodeHandle, ParameterInterface, QoSProfile, RclrsError, TimeSource, ToResult,
7-
QOS_PROFILE_CLOCK,
6+
ClockType, Context, ContextHandle, Node, NodeHandle, ParameterInterface, QoSProfile,
7+
RclrsError, TimeSource, ToResult, ENTITY_LIFECYCLE_MUTEX, QOS_PROFILE_CLOCK,
88
};
99

1010
/// A builder for creating a [`Node`][1].

rclrs/src/node/graph.rs

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -266,12 +266,7 @@ impl Node {
266266
// SAFETY: The topic_name string was correctly allocated previously
267267
unsafe {
268268
let rcl_node = self.handle.rcl_node.lock().unwrap();
269-
rcl_count_publishers(
270-
&*rcl_node,
271-
topic_name.as_ptr(),
272-
&mut count,
273-
)
274-
.ok()?
269+
rcl_count_publishers(&*rcl_node, topic_name.as_ptr(), &mut count).ok()?
275270
};
276271
Ok(count)
277272
}
@@ -287,12 +282,7 @@ impl Node {
287282
// SAFETY: The topic_name string was correctly allocated previously
288283
unsafe {
289284
let rcl_node = self.handle.rcl_node.lock().unwrap();
290-
rcl_count_subscribers(
291-
&*rcl_node,
292-
topic_name.as_ptr(),
293-
&mut count,
294-
)
295-
.ok()?
285+
rcl_count_subscribers(&*rcl_node, topic_name.as_ptr(), &mut count).ok()?
296286
};
297287
Ok(count)
298288
}
@@ -469,10 +459,8 @@ mod tests {
469459

470460
#[test]
471461
fn test_graph_empty() {
472-
let context = Context::new_with_options(
473-
[],
474-
InitOptions::new().with_domain_id(Some(99))
475-
).unwrap();
462+
let context =
463+
Context::new_with_options([], InitOptions::new().with_domain_id(Some(99))).unwrap();
476464
let node_name = "test_publisher_names_and_types";
477465
let node = Node::new(&context, node_name).unwrap();
478466
// Test that the graph has no publishers

rclrs/src/publisher.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,7 @@ impl Drop for PublisherHandle {
2929
// SAFETY: No preconditions for this function (besides the arguments being valid).
3030
let mut rcl_node = self.node_handle.rcl_node.lock().unwrap();
3131
let _lifecycle_lock = ENTITY_LIFECYCLE_MUTEX.lock().unwrap();
32-
rcl_publisher_fini(
33-
self.rcl_publisher.get_mut().unwrap(),
34-
&mut *rcl_node,
35-
);
32+
rcl_publisher_fini(self.rcl_publisher.get_mut().unwrap(), &mut *rcl_node);
3633
}
3734
}
3835
}
@@ -116,7 +113,7 @@ where
116113
handle: PublisherHandle {
117114
rcl_publisher: Mutex::new(rcl_publisher),
118115
node_handle,
119-
}
116+
},
120117
})
121118
}
122119

rclrs/src/subscription.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use rosidl_runtime_rs::{Message, RmwMessage};
88

99
use crate::error::{RclReturnCode, ToResult};
1010
use crate::qos::QoSProfile;
11-
use crate::{rcl_bindings::*, RclrsError, NodeHandle, ENTITY_LIFECYCLE_MUTEX};
11+
use crate::{rcl_bindings::*, NodeHandle, RclrsError, ENTITY_LIFECYCLE_MUTEX};
1212

1313
mod callback;
1414
mod message_info;

rclrs/src/wait.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use std::vec::Vec;
2121

2222
use crate::error::{to_rclrs_result, RclReturnCode, RclrsError, ToResult};
2323
use crate::rcl_bindings::*;
24-
use crate::{ClientBase, Context, Node, ServiceBase, SubscriptionBase, ContextHandle};
24+
use crate::{ClientBase, Context, ContextHandle, Node, ServiceBase, SubscriptionBase};
2525

2626
mod exclusivity_guard;
2727
mod guard_condition;

rclrs/src/wait/guard_condition.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@ impl GuardCondition {
139139
pub fn trigger(&self) -> Result<(), RclrsError> {
140140
unsafe {
141141
// SAFETY: The rcl_guard_condition_t is valid.
142-
rcl_trigger_guard_condition(&mut *self.handle.rcl_guard_condition.lock().unwrap()).ok()?;
142+
rcl_trigger_guard_condition(&mut *self.handle.rcl_guard_condition.lock().unwrap())
143+
.ok()?;
143144
}
144145
if let Some(callback) = &self.callback {
145146
callback();

0 commit comments

Comments
 (0)