Skip to content

Commit 56d126b

Browse files
author
Julien Loudet
committed
montblanc: clippy + move dependencies to workspace Cargo.toml
Signed-off-by: Julien Loudet <julien.loudet@zettascale.tech>
1 parent 77dffe8 commit 56d126b

File tree

32 files changed

+217
-261
lines changed

32 files changed

+217
-261
lines changed

montblanc/Cargo.toml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,10 @@ codegen-units=1
4848
opt-level=3
4949
panic="abort"
5050

51-
[patch.crates-io]
52-
zenoh-flow = { git = "https://github.com/eclipse-zenoh/zenoh-flow.git", branch = "master"}
51+
[workspace.dependencies]
52+
async-std = { version = "=1.12.0", features = ["attributes"] }
53+
async-trait = "0.1.50"
54+
futures = "0.3.28"
55+
prost = "0.11"
56+
rand = "0.8.0"
57+
zenoh-flow = "0.5.0-alpha.1"

montblanc/arequipa/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ crate-type=["cdylib"]
2323
path="src/lib.rs"
2424

2525
[dependencies]
26+
async-std = { workspace = true }
27+
async-trait = { workspace = true }
2628
datatypes = { path = "../datatypes" }
27-
async-std = { version = "=1.12.0", features = ["attributes"] }
28-
async-trait = "0.1.50"
29-
zenoh-flow = "0.5.0-dev"
30-
prost = "0.11"
29+
prost = { workspace = true }
30+
zenoh-flow = { workspace = true }

montblanc/barcelona/Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ crate-type=["cdylib"]
2323
path="src/lib.rs"
2424

2525
[dependencies]
26-
async-std = { version = "=1.12.0", features = ["attributes"] }
26+
async-std = { workspace = true }
27+
async-trait = { workspace = true }
2728
datatypes = { path = "../datatypes" }
28-
async-trait = "0.1.50"
29-
zenoh-flow = "0.5.0-dev"
30-
futures = "0.3.5"
31-
rand = "0.8.0"
32-
prost = "0.11"
29+
futures = { workspace = true }
30+
prost = { workspace = true }
31+
rand = { workspace = true }
32+
zenoh-flow = { workspace = true }

montblanc/barcelona/src/lib.rs

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use datatypes::data_types;
1616
use datatypes::{LENA_PORT, MEKONG_PORT};
1717
use futures::prelude::*;
1818
use futures::select;
19-
use prost::Message;
19+
use prost::Message as pMessage;
2020
use rand::random;
2121
use zenoh_flow::prelude::*;
2222

@@ -54,34 +54,32 @@ impl Operator for Barcelona {
5454
impl Node for Barcelona {
5555
async fn iteration(&self) -> Result<()> {
5656
select! {
57-
msg = self.input_mekong.recv().fuse() => {
58-
if let Ok((msg, _ts)) = msg {
59-
if let zenoh_flow::prelude::Message::Data(data) = msg {
60-
let value = data_types::WrenchStamped {
61-
header: Some(data.header.clone().unwrap_or(random())),
62-
wrench: Some(data_types::Wrench {
63-
force: data
64-
.twist
65-
.as_ref()
66-
.ok_or_else(|| zferror!(ErrorKind::Empty))?
67-
.twist
68-
.as_ref()
69-
.ok_or_else(|| zferror!(ErrorKind::Empty))?
70-
.linear
71-
.clone(),
72-
torque: data
73-
.twist
74-
.as_ref()
75-
.ok_or_else(|| zferror!(ErrorKind::Empty))?
76-
.twist
77-
.as_ref()
78-
.ok_or_else(|| zferror!(ErrorKind::Empty))?
79-
.angular
80-
.clone(),
81-
}),
82-
};
83-
self.output_lena.send(value, None).await?;
84-
}
57+
msg = self.input_mekong.recv().fuse() => {
58+
if let Ok((Message::Data(data), _ts)) = msg {
59+
let value = data_types::WrenchStamped {
60+
header: Some(data.header.clone().unwrap_or(random())),
61+
wrench: Some(data_types::Wrench {
62+
force: data
63+
.twist
64+
.as_ref()
65+
.ok_or_else(|| zferror!(ErrorKind::Empty))?
66+
.twist
67+
.as_ref()
68+
.ok_or_else(|| zferror!(ErrorKind::Empty))?
69+
.linear
70+
.clone(),
71+
torque: data
72+
.twist
73+
.as_ref()
74+
.ok_or_else(|| zferror!(ErrorKind::Empty))?
75+
.twist
76+
.as_ref()
77+
.ok_or_else(|| zferror!(ErrorKind::Empty))?
78+
.angular
79+
.clone(),
80+
}),
81+
};
82+
self.output_lena.send(value, None).await?;
8583
}
8684
}
8785
}

montblanc/cordoba/Cargo.toml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,9 @@ crate-type=["cdylib"]
2323
path="src/lib.rs"
2424

2525
[dependencies]
26-
async-std = { version = "=1.12.0", features = ["attributes"] }
26+
async-std = { workspace = true }
27+
async-trait = { workspace = true }
2728
datatypes = { path = "../datatypes" }
28-
29-
async-trait = "0.1.50"
30-
zenoh-flow = "0.5.0-dev"
31-
rand = "0.8.0"
32-
prost = "0.11"
29+
prost = { workspace = true }
30+
rand = { workspace = true }
31+
zenoh-flow = { workspace = true }

montblanc/datatypes/Cargo.toml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@ version = "0.1.0"
1818
edition = "2018"
1919

2020
[dependencies]
21-
bytes = "1.1"
22-
prost = "0.11"
23-
rand = "0.8.4"
24-
prost-build = "0.11"
21+
async-std = { workspace = true }
22+
async-trait = { workspace = true }
2523
chrono = "0.4"
26-
zenoh-flow = "0.5.0-dev"
24+
futures = { workspace = true }
25+
prost = { workspace = true }
26+
prost-build = "0.11"
27+
rand = { workspace = true }
28+
zenoh-flow = { workspace = true }
2729

2830
[build-dependencies]
2931
prost-build = "0.11"

montblanc/delhi/Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ crate-type=["cdylib"]
2323
path="src/lib.rs"
2424

2525
[dependencies]
26-
async-std = { version = "=1.12.0", features = ["attributes"] }
27-
datatypes = { path = "../datatypes" }
2826

29-
async-trait = "0.1.50"
30-
zenoh-flow = "0.5.0-dev"
31-
rand = "0.8.0"
32-
prost = "0.11"
27+
async-std = { workspace = true }
28+
async-trait = { workspace = true }
29+
datatypes = { path = "../datatypes" }
30+
prost = { workspace = true }
31+
rand = { workspace = true }
32+
zenoh-flow = { workspace = true }

montblanc/freeport/Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ crate-type=["cdylib"]
2323
path="src/lib.rs"
2424

2525
[dependencies]
26-
async-std = { version = "=1.12.0", features = ["attributes"] }
26+
async-std = { workspace = true }
27+
async-trait = { workspace = true }
2728
datatypes = { path = "../datatypes" }
28-
prost = "0.11"
29-
async-trait = "0.1.50"
30-
zenoh-flow = "0.5.0-dev"
31-
rand = "0.8.0"
29+
prost = { workspace = true }
30+
rand = { workspace = true }
31+
zenoh-flow = { workspace = true }

montblanc/geneva/Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ crate-type=["cdylib"]
2323
path="src/lib.rs"
2424

2525
[dependencies]
26-
async-std = { version = "=1.12.0", features = ["attributes"] }
26+
async-std = { workspace = true }
27+
async-trait = { workspace = true }
2728
datatypes = { path = "../datatypes" }
28-
prost = "0.11"
29-
async-trait = "0.1.50"
30-
zenoh-flow = "0.5.0-dev"
31-
futures = "0.3.5"
32-
rand = "0.8.0"
29+
futures = { workspace = true }
30+
prost = { workspace = true }
31+
rand = { workspace = true }
32+
zenoh-flow = { workspace = true }
3333

montblanc/geneva/src/lib.rs

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use datatypes::data_types;
1717
use datatypes::{ARKANSAS_PORT, CONGO_PORT, DANUBE_PORT, PARANA_PORT, TAGUS_PORT};
1818
use futures::prelude::*;
1919
use futures::select;
20-
use prost::Message;
20+
use prost::Message as _;
2121
use rand::random;
2222
use std::sync::Arc;
2323
use zenoh_flow::prelude::*;
@@ -86,36 +86,29 @@ impl Node for Geneva {
8686
async fn iteration(&self) -> Result<()> {
8787
select! {
8888
msg = self.input_danube.recv().fuse() => {
89-
if let Ok((msg, _ts)) = msg {
90-
if let zenoh_flow::prelude::Message::Data(inner_data) = msg {
91-
self.state.lock().await.danube_last_val = (*inner_data).clone();
92-
}
89+
if let Ok((Message::Data(inner_data), _ts)) = msg {
90+
self.state.lock().await.danube_last_val = (*inner_data).clone();
9391
}
9492
},
9593
msg = self.input_tagus.recv().fuse() => {
96-
if let Ok((msg, _ts)) = msg {
97-
if let zenoh_flow::prelude::Message::Data(inner_data) = msg {
94+
if let Ok((Message::Data(inner_data), _ts)) = msg {
9895
self.state.lock().await.tagus_last_val = (*inner_data).clone();
9996
}
100-
}
10197
},
10298
msg = self.input_congo.recv().fuse() => {
103-
if let Ok((msg, _ts)) = msg {
104-
if let zenoh_flow::prelude::Message::Data(inner_data) = msg {
99+
if let Ok((Message::Data(inner_data), _ts)) = msg {
105100
self.state.lock().await.congo_last_val = (*inner_data).clone();
106-
}}
101+
}
107102
},
108103
msg = self.input_parana.recv().fuse() => {
109-
if let Ok((msg, _ts)) = msg {
110-
if let zenoh_flow::prelude::Message::Data(inner_data) = msg {
104+
if let Ok((Message::Data(inner_data), _ts)) = msg {
111105
let value = data_types::String {
112106
value: format!("geneva/arkansas:{}", inner_data.value),
113107
};
114108

115109
self.output_arkansas.send(value, None).await?;
116110
}
117111
}
118-
}
119112
}
120113
Ok(())
121114
}

0 commit comments

Comments
 (0)