diff --git a/.github/workflows/rust-minimal.yml b/.github/workflows/rust-minimal.yml index 3c3e03105..51b598b5a 100644 --- a/.github/workflows/rust-minimal.yml +++ b/.github/workflows/rust-minimal.yml @@ -68,7 +68,7 @@ jobs: components: clippy, rustfmt # Colcon can not be run in a venv which is required in Ubuntu Noble - # Removing the externally managed file + # Removing the externally managed file - name: Install colcon-cargo and colcon-ros-cargo run: | sudo rm -f /usr/lib/python3.12/EXTERNALLY-MANAGED @@ -117,9 +117,7 @@ jobs: echo "Running cargo test in $path" # Run cargo test for all features except use_ros_shim (needed for docs.rs) if [ "$(basename $path)" = "rclrs" ]; then - cargo test -F default,dyn_msg - elif [ "$(basename $path)" = "rosidl_runtime_rs" ]; then - cargo test -F default + cargo test -F default,dyn_msg,serde else cargo test --all-features fi diff --git a/.github/workflows/rust-stable.yml b/.github/workflows/rust-stable.yml index 65fe8b2a2..ed67407f6 100644 --- a/.github/workflows/rust-stable.yml +++ b/.github/workflows/rust-stable.yml @@ -68,7 +68,7 @@ jobs: components: clippy, rustfmt # Colcon can not be run in a venv which is required in Ubuntu Noble - # Removing the externally managed file + # Removing the externally managed file - name: Install colcon-cargo and colcon-ros-cargo run: | sudo rm -f /usr/lib/python3.12/EXTERNALLY-MANAGED @@ -117,9 +117,7 @@ jobs: echo "Running cargo test in $path" # Run cargo test for all features except use_ros_shim (needed for docs.rs) if [ "$(basename $path)" = "rclrs" ]; then - cargo test -F default,dyn_msg - elif [ "$(basename $path)" = "rosidl_runtime_rs" ]; then - cargo test -F default + cargo test -F default,dyn_msg,serde else cargo test --all-features fi diff --git a/rclrs/src/client.rs b/rclrs/src/client.rs index de79b5b5f..b31aeb2ed 100644 --- a/rclrs/src/client.rs +++ b/rclrs/src/client.rs @@ -567,8 +567,7 @@ unsafe impl Send for rcl_client_t {} #[cfg(test)] mod tests { use super::*; - use crate::test_helpers::*; - use crate::vendor::test_msgs; + use crate::{test_helpers::*, vendor::test_msgs}; #[test] fn traits() { diff --git a/rclrs/src/publisher.rs b/rclrs/src/publisher.rs index a447f3b50..f5540957d 100644 --- a/rclrs/src/publisher.rs +++ b/rclrs/src/publisher.rs @@ -344,8 +344,7 @@ mod tests { #[test] fn test_publishers() -> Result<(), RclrsError> { - use crate::vendor::test_msgs::msg; - use crate::TopicEndpointInfo; + use crate::{vendor::test_msgs::msg, TopicEndpointInfo}; let namespace = "/test_publishers_graph"; let graph = construct_test_graph(namespace)?; diff --git a/rclrs/src/publisher/loaned_message.rs b/rclrs/src/publisher/loaned_message.rs index e8911ce9b..4a39d7001 100644 --- a/rclrs/src/publisher/loaned_message.rs +++ b/rclrs/src/publisher/loaned_message.rs @@ -98,8 +98,7 @@ mod tests { #[test] fn traits() { - use crate::test_helpers::*; - use crate::vendor::test_msgs; + use crate::{test_helpers::*, vendor::test_msgs}; assert_send::>(); assert_sync::>(); diff --git a/rclrs/src/service.rs b/rclrs/src/service.rs index 4537d7b6e..9adf00997 100644 --- a/rclrs/src/service.rs +++ b/rclrs/src/service.rs @@ -400,8 +400,7 @@ mod tests { #[test] fn test_services() -> Result<(), RclrsError> { - use crate::vendor::test_msgs::srv; - use crate::TopicNamesAndTypes; + use crate::{vendor::test_msgs::srv, TopicNamesAndTypes}; let namespace = "/test_services_graph"; let graph = construct_test_graph(namespace)?; diff --git a/rclrs/src/subscription.rs b/rclrs/src/subscription.rs index f8c119366..37dd6140c 100644 --- a/rclrs/src/subscription.rs +++ b/rclrs/src/subscription.rs @@ -411,8 +411,7 @@ impl Drop for SubscriptionHandle { #[cfg(test)] mod tests { use super::*; - use crate::test_helpers::*; - use crate::vendor::test_msgs::msg; + use crate::{test_helpers::*, vendor::test_msgs::msg}; #[test] fn traits() { @@ -523,8 +522,7 @@ mod tests { #[test] fn test_delayed_subscription() { - use crate::vendor::example_interfaces::msg::Empty; - use crate::*; + use crate::{vendor::example_interfaces::msg::Empty, *}; use futures::{ channel::{mpsc, oneshot}, StreamExt, diff --git a/rclrs/src/subscription/readonly_loaned_message.rs b/rclrs/src/subscription/readonly_loaned_message.rs index adeab0df7..5de250a6d 100644 --- a/rclrs/src/subscription/readonly_loaned_message.rs +++ b/rclrs/src/subscription/readonly_loaned_message.rs @@ -60,8 +60,7 @@ mod tests { #[test] fn traits() { - use crate::test_helpers::*; - use crate::vendor::test_msgs; + use crate::{test_helpers::*, vendor::test_msgs}; assert_send::>(); assert_sync::>(); diff --git a/rclrs/src/vendor/example_interfaces/action.rs b/rclrs/src/vendor/example_interfaces/action.rs index a038e53e2..8c94dd1fa 100644 --- a/rclrs/src/vendor/example_interfaces/action.rs +++ b/rclrs/src/vendor/example_interfaces/action.rs @@ -381,9 +381,6 @@ pub mod rmw { } } - #[cfg(feature = "serde")] - use serde::{Deserialize, Serialize}; - #[link(name = "example_interfaces__rosidl_typesupport_c")] extern "C" { fn rosidl_typesupport_c__get_message_type_support_handle__example_interfaces__action__Fibonacci_SendGoal_Request( @@ -1006,9 +1003,6 @@ impl rosidl_runtime_rs::Message for Fibonacci_FeedbackMessage { } } -#[cfg(feature = "serde")] -use serde::{Deserialize, Serialize}; - #[cfg_attr(feature = "serde", derive(Deserialize, Serialize))] #[derive(Clone, Debug, PartialEq, PartialOrd)] pub struct Fibonacci_SendGoal_Request { diff --git a/rclrs/src/vendor/test_msgs/action.rs b/rclrs/src/vendor/test_msgs/action.rs index b5008a2ac..0ef37280c 100644 --- a/rclrs/src/vendor/test_msgs/action.rs +++ b/rclrs/src/vendor/test_msgs/action.rs @@ -729,9 +729,6 @@ pub mod rmw { } } - #[cfg(feature = "serde")] - use serde::{Deserialize, Serialize}; - #[link(name = "test_msgs__rosidl_typesupport_c")] extern "C" { fn rosidl_typesupport_c__get_message_type_support_handle__test_msgs__action__Fibonacci_SendGoal_Request( @@ -2030,9 +2027,6 @@ impl rosidl_runtime_rs::Message for NestedMessage_FeedbackMessage { } } -#[cfg(feature = "serde")] -use serde::{Deserialize, Serialize}; - #[cfg_attr(feature = "serde", derive(Deserialize, Serialize))] #[derive(Clone, Debug, PartialEq, PartialOrd)] pub struct Fibonacci_SendGoal_Request { diff --git a/rclrs/src/worker.rs b/rclrs/src/worker.rs index 261240ec7..5194df73a 100644 --- a/rclrs/src/worker.rs +++ b/rclrs/src/worker.rs @@ -501,11 +501,13 @@ impl WorkScope for Worker { #[cfg(test)] mod tests { - use crate::vendor::test_msgs::{ - msg::Empty as EmptyMsg, - srv::{Empty as EmptySrv, Empty_Request, Empty_Response}, + use crate::{ + vendor::test_msgs::{ + msg::Empty as EmptyMsg, + srv::{Empty as EmptySrv, Empty_Request, Empty_Response}, + }, + *, }; - use crate::*; use std::time::Duration; #[derive(Default, Clone, Copy, Debug)]