Skip to content

Commit 61419b1

Browse files
committed
rustfmt & clippy
1 parent 2da7568 commit 61419b1

File tree

3 files changed

+35
-31
lines changed

3 files changed

+35
-31
lines changed

arsdk-rs/src/command.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::jumping_sumo;
44

55
#[derive(Debug, PartialEq, Eq, Clone)]
66
pub enum Feature {
7-
Common(Option<common::Class>), // ARCOMMANDS_ID_FEATURE_COMMON = 0,
7+
Common(Option<common::Class>), // ARCOMMANDS_ID_FEATURE_COMMON = 0,
88
ArDrone3(Option<ArDrone3>), // ARCOMMANDS_ID_FEATURE_ARDRONE3 = 1,
99
Minidrone, // ARCOMMANDS_ID_FEATURE_MINIDRONE = 2,
1010
JumpingSumo(jumping_sumo::Class), // ARCOMMANDS_ID_FEATURE_JUMPINGSUMO = 3,
@@ -90,10 +90,9 @@ pub mod scroll_impl {
9090
let feature = match src.gread_with::<u8>(&mut offset, ctx)? {
9191
0 => {
9292
let class = if !src[offset..].is_empty() {
93-
9493
let common = src.gread_with(&mut offset, ctx)?;
9594
Some(common)
96-
}else {
95+
} else {
9796
None
9897
};
9998

arsdk-rs/src/parse.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,16 @@ pub(crate) fn parse_message_frames(buf: &[u8]) -> Vec<Result<FrameType, Error>>
8080
frames
8181
}
8282

83-
8483
#[cfg(test)]
8584
mod parse_message_frames {
8685
use super::*;
87-
use crate::{command::{Feature}, frame::{Frame, BufferID, Type, FrameType, Error}};
8886
use crate::jumping_sumo as js;
87+
use crate::{
88+
command::Feature,
89+
frame::{BufferID, Error, Frame, FrameType, Type},
90+
};
8991
#[test]
9092
fn test_parsable_messages() {
91-
9293
let jump_message: [u8; 15] = [
9394
0x4, 0xb, 0x1, 0xf, 0x0, 0x0, 0x0, 0x3, 0x2, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0,
9495
];
@@ -152,7 +153,11 @@ mod parse_message_frames {
152153
let actual = parse_message_frames(&buf);
153154

154155
assert_eq!(actual.len(), 1);
155-
let actual = actual.into_iter().next().expect("Should have 1 parsed frame").expect("Should be Ok(_)");
156+
let actual = actual
157+
.into_iter()
158+
.next()
159+
.expect("Should have 1 parsed frame")
160+
.expect("Should be Ok(_)");
156161

157162
assert_eq!(FrameType::Known(frame), actual);
158163
}

bebop2/examples/take_off.rs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,37 +16,37 @@ fn async_setup_logger() {
1616

1717
#[tokio::main]
1818
async fn main() -> Result<(), Box<dyn Error>> {
19-
// env_logger::init();
20-
async_setup_logger();
19+
// env_logger::init();
20+
async_setup_logger();
2121

22-
let drone = Bebop2::connect(PARROT_SPHINX_CONFIG)?;
22+
let drone = Bebop2::connect(PARROT_SPHINX_CONFIG)?;
2323

24-
info!("Takeoff!");
25-
drone.take_off()?;
24+
info!("Takeoff!");
25+
drone.take_off()?;
2626

27-
info!("Wait 5 seconds and fly UP");
28-
delay_for(Duration::from_secs(5)).await;
29-
for i in 0..254 {
30-
drone.up(i)?;
31-
delay_for(Duration::from_millis(25)).await;
32-
}
27+
info!("Wait 5 seconds and fly UP");
28+
delay_for(Duration::from_secs(5)).await;
29+
for i in 0..254 {
30+
drone.up(i)?;
31+
delay_for(Duration::from_millis(25)).await;
32+
}
3333

34-
info!("Wait 5 seconds and fly DOWN");
35-
delay_for(Duration::from_secs(5)).await;
34+
info!("Wait 5 seconds and fly DOWN");
35+
delay_for(Duration::from_secs(5)).await;
3636

37-
for i in 0..220 {
38-
drone.down(i)?;
39-
delay_for(Duration::from_millis(25)).await;
40-
}
37+
for i in 0..220 {
38+
drone.down(i)?;
39+
delay_for(Duration::from_millis(25)).await;
40+
}
4141

42-
info!("Hover for 4 seconds before landing");
43-
delay_for(Duration::from_secs(4)).await;
42+
info!("Hover for 4 seconds before landing");
43+
delay_for(Duration::from_secs(4)).await;
4444

45-
for _ in 0..50 {
46-
drone.landing()?;
47-
delay_for(Duration::from_millis(25)).await;
48-
}
45+
for _ in 0..50 {
46+
drone.landing()?;
47+
delay_for(Duration::from_millis(25)).await;
48+
}
4949

50-
loop {}
50+
loop {}
5151
// })
5252
}

0 commit comments

Comments
 (0)