Skip to content

Commit 2494426

Browse files
authored
Update Rust and dependencies (#31)
* chore: Update Rust to 1.91, fix new clippy complaints * chore: Update dependencies * Fix prost to 0.13 as 0.14 is incompatible with the generated protobuf code * Fix daemonize to 0.5.0 * Fix breaking changes
2 parents c32bff5 + 33e10e0 commit 2494426

11 files changed

Lines changed: 420 additions & 315 deletions

File tree

Cargo.lock

Lines changed: 386 additions & 279 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ env_logger = "0"
1616
itertools = "0"
1717
libc = "0"
1818
log = { version = "0", features = ["std"] }
19-
prost = "0"
19+
prost = "0.13"
2020
protobuf = { git = "https://github.com/thinkparq/protobuf", rev = "24f942a79ffa8a879b84dc014384c9f06780d2b7" }
2121
regex = "1"
2222
ring = "0"

mgmtd/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ sqlite_check = { path = "../sqlite_check" }
2525

2626
anyhow = { workspace = true }
2727
clap = { workspace = true, features = ["derive"] }
28-
daemonize = "0"
28+
daemonize = "=0.5.0"
2929
env_logger = { workspace = true }
3030
itertools = { workspace = true }
3131
libc = { workspace = true }

mgmtd/src/bee_msg/common.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,11 @@ pub(super) async fn update_node(msg: RegisterNode, app: &impl App) -> Result<Nod
4343
None
4444
};
4545

46-
if let Some(machine_uuid) = machine_uuid {
47-
if db::node::count_machines(tx, machine_uuid, node.as_ref().map(|n| n.uid))?
46+
if let Some(machine_uuid) = machine_uuid
47+
&& db::node::count_machines(tx, machine_uuid, node.as_ref().map(|n| n.uid))?
4848
>= licensed_machines
49-
{
50-
bail!("Licensed machine limit reached. Node registration denied.");
51-
}
49+
{
50+
bail!("Licensed machine limit reached. Node registration denied.");
5251
}
5352

5453
let (node, is_new) = if let Some(node) = node {

mgmtd/src/config.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -429,10 +429,10 @@ generate_structs! {
429429

430430
impl Config {
431431
pub fn check_validity(&self) -> Result<()> {
432-
if let Some(ref uuid) = self.fs_uuid {
433-
if uuid.get_version_num() != 4 {
434-
bail!("Provided file system UUID is not a valid v4 UUID");
435-
}
432+
if let Some(ref uuid) = self.fs_uuid
433+
&& uuid.get_version_num() != 4
434+
{
435+
bail!("Provided file system UUID is not a valid v4 UUID");
436436
}
437437

438438
if self.quota_enforce && !self.quota_enable {

mgmtd/src/grpc/get_quota_usage.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -131,20 +131,20 @@ pub(crate) async fn get_quota_usage(
131131

132132
// If this if the first entry, include the quota refresh period. Do not send it again
133133
// after to minimize message size.
134-
if offset == 0 {
135-
if let Some(entry) = entries.next() {
136-
stream
137-
.send(pm::GetQuotaUsageResponse {
138-
entry: Some(entry),
139-
refresh_period_s: Some(
140-
app.static_info()
141-
.user_config
142-
.quota_update_interval
143-
.as_secs(),
144-
),
145-
})
146-
.await?;
147-
}
134+
if offset == 0
135+
&& let Some(entry) = entries.next()
136+
{
137+
stream
138+
.send(pm::GetQuotaUsageResponse {
139+
entry: Some(entry),
140+
refresh_period_s: Some(
141+
app.static_info()
142+
.user_config
143+
.quota_update_interval
144+
.as_secs(),
145+
),
146+
})
147+
.await?;
148148
}
149149

150150
// Send all the (remaining) entries to the client

mgmtd/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ fn init_db(db_file: &Path, v7_path: Option<&Path>, fs_uuid: Option<Uuid>) -> Res
192192
.parent()
193193
.ok_or_else(|| anyhow!("File does not have a parent folder"))?,
194194
)?;
195-
conn.backup(rusqlite::DatabaseName::Main, db_file, None)?;
195+
conn.backup(rusqlite::MAIN_DB, db_file, None)?;
196196

197197
Ok(())
198198
})()

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "1.88"
2+
channel = "1.91"
33
profile = "default"

shared/src/conn/incoming.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,11 @@ async fn stream_loop(
111111
.await
112112
{
113113
// If the error comes from the connection being closed, we only log a debug message
114-
if let Some(inner) = err.downcast_ref::<io::Error>() {
115-
if let ErrorKind::UnexpectedEof = inner.kind() {
116-
log::debug!("Closed stream from {:?}: {err:#}", stream.addr());
117-
return;
118-
}
114+
if let Some(inner) = err.downcast_ref::<io::Error>()
115+
&& let ErrorKind::UnexpectedEof = inner.kind()
116+
{
117+
log::debug!("Closed stream from {:?}: {err:#}", stream.addr());
118+
return;
119119
}
120120

121121
log::error!(

shared/src/nic.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,11 @@ impl NicFilter {
4545
let mut split = input.split_whitespace().peekable();
4646
let mut res = Self::default();
4747

48-
if let Some(field) = split.peek() {
49-
if *field == "!" {
48+
if let Some(field) = split.peek()
49+
&& *field == "!" {
5050
res.invert = true;
5151
split.next();
5252
}
53-
}
5453

5554
if let Some(field) = split.next() && field != "*" {
5655
res.name = Some(field.to_string());

0 commit comments

Comments
 (0)