Skip to content

Commit

Permalink
Fix clippy::items_after_test_module warning
Browse files Browse the repository at this point in the history
```
error: items after a test module
   --> tf_rosrust/src/transforms.rs:136:1
    |
136 |   mod test {
    |   ^^^^^^^^
...
217 | / pub(crate) fn to_transform_stamped(
218 | |     tf: Transform,
219 | |     from: std::string::String,
220 | |     to: std::string::String,
221 | |     time: rosrust::Time,
222 | | ) -> TransformStamped {
    | |_____________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#items_after_test_module
    = note: `-D clippy::items-after-test-module` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::items_after_test_module)]`
    = help: move the items to before the test module was defined
```
  • Loading branch information
taiki-e committed Jan 11, 2024
1 parent 63037b1 commit 93d77c5
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 33 deletions.
32 changes: 16 additions & 16 deletions tf_r2r/src/transforms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,22 @@ pub fn interpolate(t1: Transform, t2: Transform, weight: f64) -> Transform {
}
}

pub(crate) fn to_transform_stamped(
tf: Transform,
from: std::string::String,
to: std::string::String,
time: &r2r::builtin_interfaces::msg::Time,
) -> TransformStamped {
TransformStamped {
header: Header {
frame_id: from,
stamp: time.clone(),
},
child_frame_id: to,
transform: tf,
}
}

#[cfg(test)]
mod test {
use super::*;
Expand Down Expand Up @@ -203,19 +219,3 @@ mod test {
assert_eq!(interpolate(tf1, tf2, 0.5), expected);
}
}

pub(crate) fn to_transform_stamped(
tf: Transform,
from: std::string::String,
to: std::string::String,
time: &r2r::builtin_interfaces::msg::Time,
) -> TransformStamped {
TransformStamped {
header: Header {
frame_id: from,
stamp: time.clone(),
},
child_frame_id: to,
transform: tf,
}
}
34 changes: 17 additions & 17 deletions tf_rosrust/src/transforms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,23 @@ pub fn interpolate(t1: Transform, t2: Transform, weight: f64) -> Transform {
}
}

pub(crate) fn to_transform_stamped(
tf: Transform,
from: std::string::String,
to: std::string::String,
time: rosrust::Time,
) -> TransformStamped {
TransformStamped {
header: Header {
frame_id: from,
stamp: time,
seq: 1u32,
},
child_frame_id: to,
transform: tf,
}
}

#[cfg(test)]
mod test {
use super::*;
Expand Down Expand Up @@ -213,20 +230,3 @@ mod test {
assert_eq!(interpolate(tf1, tf2, 0.5), expected);
}
}

pub(crate) fn to_transform_stamped(
tf: Transform,
from: std::string::String,
to: std::string::String,
time: rosrust::Time,
) -> TransformStamped {
TransformStamped {
header: Header {
frame_id: from,
stamp: time,
seq: 1u32,
},
child_frame_id: to,
transform: tf,
}
}

0 comments on commit 93d77c5

Please sign in to comment.