Skip to content

Commit

Permalink
Fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
esteve committed Jul 13, 2023
1 parent ed0b2ed commit 3d699ef
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion rclrs/src/dynamic_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ fn get_type_support_library(
let ament = ament_rs::Ament::new().map_err(|_| RequiredPrefixNotSourced {
package: package_name.to_owned(),
})?;
let prefix = PathBuf::from(ament.find_package(&package_name).ok_or(
let prefix = PathBuf::from(ament.find_package(package_name).ok_or(
RequiredPrefixNotSourced {
package: package_name.to_owned(),
},
Expand Down
2 changes: 1 addition & 1 deletion rclrs/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,6 @@ pub(crate) trait ToResult {

impl ToResult for rcl_ret_t {
fn ok(&self) -> Result<(), RclrsError> {
to_rclrs_result(*self as i32)
to_rclrs_result(*self)
}
}
2 changes: 1 addition & 1 deletion rclrs/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ impl Node {
&self,
getter: unsafe extern "C" fn(*const rcl_node_t) -> *const c_char,
) -> String {
unsafe { call_string_getter_with_handle(&*self.rcl_node_mtx.lock().unwrap(), getter) }
unsafe { call_string_getter_with_handle(&self.rcl_node_mtx.lock().unwrap(), getter) }
}

/// Creates a [`Client`][1].
Expand Down
4 changes: 2 additions & 2 deletions rclrs/src/parameter/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ mod tests {
assert!(!rcl_params.is_null());
assert_eq!(unsafe { (*rcl_params).num_nodes }, 1);
let rcl_node_params = unsafe { &(*(*rcl_params).params) };
assert_eq!((*rcl_node_params).num_params, 1);
let rcl_variant = unsafe { &(*(*rcl_node_params).parameter_values) };
assert_eq!(rcl_node_params.num_params, 1);
let rcl_variant = unsafe { &(*rcl_node_params.parameter_values) };
let param_value = unsafe { ParameterValue::from_rcl_variant(rcl_variant) };
assert_eq!(param_value, pair.1);
unsafe { rcl_yaml_node_struct_fini(rcl_params) };
Expand Down
2 changes: 1 addition & 1 deletion rclrs/src/subscription.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ where
///
/// This can be more efficient for messages containing large arrays.
pub fn take_boxed(&self) -> Result<(Box<T>, MessageInfo), RclrsError> {
let mut rmw_message = Box::new(<T as Message>::RmwMsg::default());
let mut rmw_message = Box::<<T as Message>::RmwMsg>::default();
let message_info = self.take_inner(&mut *rmw_message)?;
// TODO: This will still use the stack in general. Change signature of
// from_rmw_message to allow placing the result in a Box directly.
Expand Down
5 changes: 5 additions & 0 deletions rclrs/src/vendor/rcl_interfaces/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ pub mod rmw {
pub description: rosidl_runtime_rs::String,
pub additional_constraints: rosidl_runtime_rs::String,
pub read_only: bool,
pub dynamic_typing: bool,
pub floating_point_range: rosidl_runtime_rs::BoundedSequence<
crate::vendor::rcl_interfaces::msg::rmw::FloatingPointRange,
1,
Expand Down Expand Up @@ -1269,6 +1270,7 @@ pub struct ParameterDescriptor {
pub description: std::string::String,
pub additional_constraints: std::string::String,
pub read_only: bool,
pub dynamic_typing: bool,
pub floating_point_range: rosidl_runtime_rs::BoundedSequence<
crate::vendor::rcl_interfaces::msg::rmw::FloatingPointRange,
1,
Expand Down Expand Up @@ -1298,6 +1300,7 @@ impl rosidl_runtime_rs::Message for ParameterDescriptor {
description: msg.description.as_str().into(),
additional_constraints: msg.additional_constraints.as_str().into(),
read_only: msg.read_only,
dynamic_typing: msg.dynamic_typing,
floating_point_range: msg.floating_point_range,
integer_range: msg.integer_range,
}),
Expand All @@ -1307,6 +1310,7 @@ impl rosidl_runtime_rs::Message for ParameterDescriptor {
description: msg.description.as_str().into(),
additional_constraints: msg.additional_constraints.as_str().into(),
read_only: msg.read_only,
dynamic_typing: msg.dynamic_typing,
floating_point_range: msg.floating_point_range.clone(),
integer_range: msg.integer_range.clone(),
}),
Expand All @@ -1320,6 +1324,7 @@ impl rosidl_runtime_rs::Message for ParameterDescriptor {
description: msg.description.to_string(),
additional_constraints: msg.additional_constraints.to_string(),
read_only: msg.read_only,
dynamic_typing: msg.dynamic_typing,
floating_point_range: msg.floating_point_range,
integer_range: msg.integer_range,
}
Expand Down
2 changes: 1 addition & 1 deletion rclrs/vendor_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ def main():


if __name__ == '__main__':
main()
main()

0 comments on commit 3d699ef

Please sign in to comment.