Skip to content

Commit 72e7e8d

Browse files
Merge pull request #41 from pollen-robotics/hotfix-clippy
Apply clippy rules.
2 parents 8cc4257 + 2f53c0f commit 72e7e8d

File tree

4 files changed

+6
-8
lines changed

4 files changed

+6
-8
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rustypot"
3-
version = "0.4.1"
3+
version = "0.4.2"
44
edition = "2021"
55
license = "Apache-2.0"
66
authors = ["Pollen Robotics"]

src/device/mx.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ pub mod conv {
135135
///
136136
/// Works for torque_limit for instance
137137
pub fn torque_to_dxl_abs_load(torque: f64) -> u16 {
138-
assert!(torque >= 0.0 && torque <= 100.0);
138+
assert!((0.0..=100.0).contains(&torque));
139139

140140
(torque * 1023.0 / 100.0) as u16
141141
}

src/protocol/v1.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,6 @@ pub enum DynamixelErrorV1 {
198198
impl DynamixelErrorV1 {
199199
fn from_byte(error: u8) -> Vec<Self> {
200200
(0..7)
201-
.into_iter()
202201
.filter(|i| error & (1 << i) != 0)
203202
.map(|i| DynamixelErrorV1::from_bit(i).unwrap())
204203
.collect()
@@ -306,11 +305,11 @@ mod tests {
306305

307306
#[test]
308307
fn create_write_packet() {
309-
let p = PacketV1::write_packet(10, 24, &vec![1]);
308+
let p = PacketV1::write_packet(10, 24, &[1]);
310309
let bytes = p.to_bytes();
311310
assert_eq!(bytes, [255, 255, 10, 4, 3, 24, 1, 213]);
312311

313-
let p = PacketV1::write_packet(0xFE, 0x03, &vec![1]);
312+
let p = PacketV1::write_packet(0xFE, 0x03, &[1]);
314313
let bytes = p.to_bytes();
315314
assert_eq!(bytes, [0xFF, 0xFF, 0xFE, 0x04, 0x03, 0x03, 0x01, 0xF6]);
316315
}
@@ -327,7 +326,7 @@ mod tests {
327326

328327
#[test]
329328
fn create_sync_write_packet() {
330-
let p = PacketV1::sync_write_packet(&[11, 12], 30, &vec![vec![0x0, 0x0], vec![0xA, 0x14]]);
329+
let p = PacketV1::sync_write_packet(&[11, 12], 30, &[vec![0x0, 0x0], vec![0xA, 0x14]]);
331330
let bytes = p.to_bytes();
332331
assert_eq!(
333332
bytes,

src/protocol/v2.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,6 @@ pub enum DynamixelErrorV2 {
271271
impl DynamixelErrorV2 {
272272
fn from_byte(error: u8) -> Vec<Self> {
273273
(1..7)
274-
.into_iter()
275274
.filter(|i| error & (1 << i) != 0)
276275
.map(|i| DynamixelErrorV2::from_bit(i).unwrap())
277276
.collect()
@@ -389,7 +388,7 @@ mod tests {
389388
let p = PacketV2::sync_write_packet(
390389
&[1, 2],
391390
116,
392-
&vec![
391+
&[
393392
150_u32.to_le_bytes().to_vec(),
394393
170_u32.to_le_bytes().to_vec(),
395394
],

0 commit comments

Comments
 (0)