From f31fbf40cede4f228dc3aa7506000362b0baa8f0 Mon Sep 17 00:00:00 2001 From: Lorenz Leutgeb Date: Thu, 16 Jul 2026 17:53:01 +0200 Subject: [PATCH] =?UTF-8?q?rust:=201.95=20=E2=86=92=201.97.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The update to `flake.lock` is a simple nix flake update rust-overlay to be able to reach 1.97.1. The changes to `**/*.rs` files are improvements suggested by Clippy. --- crates/radicle-cli/src/commands/cob.rs | 4 +-- crates/radicle-node/src/runtime.rs | 4 +-- crates/radicle-protocol/src/service.rs | 2 +- crates/radicle-protocol/src/service/io.rs | 2 +- .../radicle-protocol/src/service/message.rs | 11 +++---- crates/radicle/src/git/canonical/symbolic.rs | 5 +-- crates/radicle/src/identity/doc.rs | 32 +++++++++++-------- crates/radicle/src/identity/doc/update.rs | 5 +-- crates/radicle/src/storage/git.rs | 2 +- flake.lock | 6 ++-- rust-toolchain.toml | 2 +- 11 files changed, 36 insertions(+), 39 deletions(-) diff --git a/crates/radicle-cli/src/commands/cob.rs b/crates/radicle-cli/src/commands/cob.rs index 4db3a8fae..b89ce39a8 100644 --- a/crates/radicle-cli/src/commands/cob.rs +++ b/crates/radicle-cli/src/commands/cob.rs @@ -70,7 +70,7 @@ pub fn run(args: Args, ctx: impl term::Context) -> anyhow::Result<()> { } Identity => anyhow::bail!( "Creation of collaborative objects of type {} is not supported.", - &type_name + type_name ), Other(type_name) => { let mut store: Store = @@ -195,7 +195,7 @@ pub fn run(args: Args, ctx: impl term::Context) -> anyhow::Result<()> { } Identity => anyhow::bail!( "Update of collaborative objects of type {} is not supported.", - &type_name + type_name ), Other(type_name) => { use cob::external::{Action, External}; diff --git a/crates/radicle-node/src/runtime.rs b/crates/radicle-node/src/runtime.rs index 799d87362..8744456ab 100644 --- a/crates/radicle-node/src/runtime.rs +++ b/crates/radicle-node/src/runtime.rs @@ -168,7 +168,7 @@ impl Runtime { Err(e) => return Err(e.into()), } - log::info!(target: "node", "Default seeding policy set to '{}'", &policy); + log::info!(target: "node", "Default seeding policy set to '{}'", policy); log::info!(target: "node", "Initializing service ({network:?}).."); let announcement = service::gossip::node(&config, timestamp) @@ -360,7 +360,7 @@ impl Runtime { } } - log::info!(target: "node", "Binding control socket {}..", &path.display()); + log::info!(target: "node", "Binding control socket {}..", path.display()); match UnixListener::bind(&path) { Ok(sock) => Ok(ControlSocket::Bound(sock, path)), Err(err) if err.kind() == io::ErrorKind::AddrInUse => Err(Error::AlreadyRunning(path)), diff --git a/crates/radicle-protocol/src/service.rs b/crates/radicle-protocol/src/service.rs index 3682d2515..c63aad0f7 100644 --- a/crates/radicle-protocol/src/service.rs +++ b/crates/radicle-protocol/src/service.rs @@ -2530,7 +2530,7 @@ where /// Run idle task for all connections. fn idle_connections(&mut self) { - for (_, sess) in self.sessions.iter_mut() { + for sess in self.sessions.values_mut() { sess.idle(self.clock); if sess.is_stable() { diff --git a/crates/radicle-protocol/src/service/io.rs b/crates/radicle-protocol/src/service/io.rs index 60a6c4b5c..d67d7b7e6 100644 --- a/crates/radicle-protocol/src/service/io.rs +++ b/crates/radicle-protocol/src/service/io.rs @@ -68,7 +68,7 @@ impl Outbox { _ => log::Level::Debug, }; msg.log(level, &remote.id, Link::Outbound); - trace!(target: "service", "Write {:?} to {}", &msg, remote); + trace!(target: "service", "Write {:?} to {}", msg, remote); self.io.push_back(Io::Write(remote.id, vec![msg])); } diff --git a/crates/radicle-protocol/src/service/message.rs b/crates/radicle-protocol/src/service/message.rs index c78bb2a93..945fd0e6e 100644 --- a/crates/radicle-protocol/src/service/message.rs +++ b/crates/radicle-protocol/src/service/message.rs @@ -107,14 +107,11 @@ impl NodeAnnouncement { /// is returned. pub fn solve(mut self, target: u32) -> Option { loop { - if let Some(nonce) = self.nonce.checked_add(1) { - self.nonce = nonce; + let nonce = self.nonce.checked_add(1)?; + self.nonce = nonce; - if self.work() >= target { - break; - } - } else { - return None; + if self.work() >= target { + break; } } Some(self) diff --git a/crates/radicle/src/git/canonical/symbolic.rs b/crates/radicle/src/git/canonical/symbolic.rs index 9b1a7b069..04f1e1fca 100644 --- a/crates/radicle/src/git/canonical/symbolic.rs +++ b/crates/radicle/src/git/canonical/symbolic.rs @@ -202,10 +202,7 @@ impl SymbolicRefs { loop { match current { Target::Direct(q) => return Some(q.as_ref()), - Target::Symbolic(s) => match self.0.get(s.as_ref()) { - Some(next) => current = next, - None => return None, - }, + Target::Symbolic(s) => current = self.0.get(s.as_ref())?, } } } diff --git a/crates/radicle/src/identity/doc.rs b/crates/radicle/src/identity/doc.rs index ad9e39ae2..7230ff2bd 100644 --- a/crates/radicle/src/identity/doc.rs +++ b/crates/radicle/src/identity/doc.rs @@ -818,10 +818,12 @@ impl Doc { (Some(ref default_branch), Ok(project)) => { let project_branch = project.default_branch_qualified(); if project_branch != *default_branch { - return Err(DefaultBranchRuleError::HeadMismatch { - cref: default_branch.to_ref_string(), - project: project_branch.to_ref_string(), - })?; + return Err(CanonicalRefsError::DefaultBranchRuleError( + DefaultBranchRuleError::HeadMismatch { + cref: default_branch.to_ref_string(), + project: project_branch.to_ref_string(), + }, + )); } self.validate_head_rule(&raw_crefs, default_branch)?; } @@ -855,19 +857,23 @@ impl Doc { let allowed = rule.allowed(); if *allowed != rules::Allowed::Delegates { - return Err(DefaultBranchRuleError::Allowed { - pattern: pattern.to_string(), - actual: allowed.to_string(), - })?; + return Err(CanonicalRefsError::DefaultBranchRuleError( + DefaultBranchRuleError::Allowed { + pattern: pattern.to_string(), + actual: allowed.to_string(), + }, + )); } let actual = *rule.threshold(); let expected = self.threshold(); if actual != expected { - return Err(DefaultBranchRuleError::Threshold { - pattern: pattern.to_string(), - actual, - expected, - })?; + return Err(CanonicalRefsError::DefaultBranchRuleError( + DefaultBranchRuleError::Threshold { + pattern: pattern.to_string(), + actual, + expected, + }, + )); } Ok(()) } diff --git a/crates/radicle/src/identity/doc/update.rs b/crates/radicle/src/identity/doc/update.rs index 1298a014d..d04f8b54c 100644 --- a/crates/radicle/src/identity/doc/update.rs +++ b/crates/radicle/src/identity/doc/update.rs @@ -216,10 +216,7 @@ pub fn verify(raw: RawDoc) -> Result { // 2. … symbolic reference with the name `HEAD`. // (This reference must be synthesized!) use super::GetRawCanonicalRefs as _; - match raw - .raw_canonical_refs() - .map(|rcrefs| rcrefs.and_then(|c| project.map(|p| (c, p)))) - { + match raw.raw_canonical_refs().map(|rcrefs| rcrefs.zip(project)) { Ok(Some((crefs, project))) => { let default = git::fmt::Qualified::from(git::fmt::lit::refs_heads(project.default_branch())); diff --git a/crates/radicle/src/storage/git.rs b/crates/radicle/src/storage/git.rs index 2a93d4345..d130e51d7 100644 --- a/crates/radicle/src/storage/git.rs +++ b/crates/radicle/src/storage/git.rs @@ -988,7 +988,7 @@ impl WriteRepository for Repository { if old == Some(new) { return Ok(SetHead { old, new }); } - log::debug!(target: "storage", "Setting ref: {} -> {}", &branch_ref, new); + log::debug!(target: "storage", "Setting ref: {} -> {}", branch_ref, new); self.raw() .reference(&branch_ref, new.into(), true, "set-local-branch (radicle)")?; diff --git a/flake.lock b/flake.lock index 9bf90eaf3..d751b88cd 100644 --- a/flake.lock +++ b/flake.lock @@ -161,11 +161,11 @@ ] }, "locked": { - "lastModified": 1778210054, - "narHash": "sha256-iYINsX0BVDxTXd0z4FzDpBYHZ9fWUtwjG9cKSXwe9Tg=", + "lastModified": 1784216271, + "narHash": "sha256-bvaxxdk7mmMQ88AuXQGTUtk+PcUujHpgxqpryqTWvTU=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "bc83d66023d19fb301ee98772643b24b6129ef48", + "rev": "1f69c7203034a4a974d7a4eac0f19b54af30804d", "type": "github" }, "original": { diff --git a/rust-toolchain.toml b/rust-toolchain.toml index f062c265c..b8b33a0a0 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] -channel = "1.95" +channel = "1.97.1" profile = "default" components = [ "rust-src" ]