Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
rust/msrv: 1.85.0 → 1.88.0
✓ CI success Lorenz Leutgeb committed 9 days ago
commit 9ea040ccd05e2c7f8b964d99cc1f65233f43271c
parent 0a0e70b1d12367a2e85ae720c14cfb0f677a54b6
1 passed (1 total) View logs
37 files changed +263 -264
modified CHANGELOG.md
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

+
## Minimum Supported Rust Version (MSRV)
+

+
The MSRV is updated to `1.88.0` due to dependencies requiring a higher bound.
+
This effectively puts all published crates in `heartwood` to an MSRV of `1.88.0`.
+

## Domain Name Migration

Following a domain move of the project, the names of the bootstrap nodes change:
modified Cargo.toml
@@ -16,7 +16,7 @@ version = "0.9.0"
# *per crate*. If anyone ever wants to set it to a different
# value per crate, this is of course possible. We're waiting
# for the day it makes a difference…
-
rust-version = "1.85.0"
+
rust-version = "1.88.0"

[workspace.dependencies]
amplify = { version = "4.0.0", default-features = false }
modified crates/radicle-cli-test/src/lib.rs
@@ -209,10 +209,10 @@ impl TestFormula {
                for result in results {
                    match result {
                        Ok(msg) => {
-
                            if let Ok(Message::CompilerArtifact(a)) = msg.decode() {
-
                                if let Some(e) = a.executable {
-
                                    log::debug!(target: "test", "Built {}", e.display());
-
                                }
+
                            if let Ok(Message::CompilerArtifact(a)) = msg.decode()
+
                                && let Some(e) = a.executable
+
                            {
+
                                log::debug!(target: "test", "Built {}", e.display());
                            }
                        }
                        Err(e) => {
modified crates/radicle-cli/src/commands/init.rs
@@ -38,10 +38,10 @@ pub fn run(args: Args, ctx: impl term::Context) -> anyhow::Result<()> {
        }
        Err(e) => return Err(e.into()),
    };
-
    if let Ok((remote, _)) = git::rad_remote(&repo) {
-
        if let Some(remote) = remote.url() {
-
            bail!("repository is already initialized with remote {remote}");
-
        }
+
    if let Ok((remote, _)) = git::rad_remote(&repo)
+
        && let Some(remote) = remote.url()
+
    {
+
        bail!("repository is already initialized with remote {remote}");
    }

    if let Some(rid) = args.existing {
modified crates/radicle-cli/src/commands/issue.rs
@@ -261,16 +261,16 @@ where
                }
            };

-
            if let Some(a) = assignee {
-
                if !issue.assignees().any(|v| v == &Did::from(a)) {
-
                    return None;
-
                }
+
            if let Some(a) = assignee
+
                && !issue.assignees().any(|v| v == &Did::from(a))
+
            {
+
                return None;
            }

-
            if let Some(s) = state {
-
                if s != issue.state() {
-
                    return None;
-
                }
+
            if let Some(s) = state
+
                && s != issue.state()
+
            {
+
                return None;
            }

            Some((id, issue))
modified crates/radicle-cli/src/commands/node/logs.rs
@@ -148,10 +148,10 @@ impl Rotate {
    /// Remove the existing file, if it exists. Then create the next log, and
    /// create a hard link to it.
    pub fn execute(self) -> io::Result<Rotated> {
-
        if let Some(to_remove) = self.remove {
-
            if let Err(err) = to_remove.execute() {
-
                log::warn!(target: "cli", "Failed to remove current log file: {err}");
-
            }
+
        if let Some(to_remove) = self.remove
+
            && let Err(err) = to_remove.execute()
+
        {
+
            log::warn!(target: "cli", "Failed to remove current log file: {err}");
        }

        let log = OpenOptions::new()
modified crates/radicle-cli/src/commands/patch/review/builder.rs
@@ -679,10 +679,10 @@ impl<'a> ReviewBuilder<'a> {
        let total = queue.len();

        while let Some((ix, item)) = queue.next() {
-
            if let Some(hunk) = self.hunk {
-
                if hunk != ix + 1 {
-
                    continue;
-
                }
+
            if let Some(hunk) = self.hunk
+
                && hunk != ix + 1
+
            {
+
                continue;
            }
            let progress = term::format::secondary(format!("({}/{total})", ix + 1));
            let file = match file.as_mut() {
modified crates/radicle-cli/src/commands/seed.rs
@@ -27,10 +27,11 @@ pub fn run(args: Args, ctx: impl term::Context) -> anyhow::Result<()> {
            for rid in rids {
                update(rid, scope, &mut node, &profile)?;

-
                if should_fetch && node.is_running() {
-
                    if let Err(e) = sync::fetch(rid, settings.clone(), &mut node, &profile) {
-
                        term::error(e);
-
                    }
+
                if should_fetch
+
                    && node.is_running()
+
                    && let Err(e) = sync::fetch(rid, settings.clone(), &mut node, &profile)
+
                {
+
                    term::error(e);
                }
            }
        }
@@ -57,11 +58,11 @@ pub fn update(
    let updated = profile.seed(rid, scope, node)?;
    let outcome = if updated { "updated" } else { "exists" };

-
    if let Ok(repo) = profile.storage.repository(rid) {
-
        if repo.identity_doc()?.is_public() {
-
            profile.add_inventory(rid, node)?;
-
            term::success!("Inventory updated with {}", term::format::tertiary(rid));
-
        }
+
    if let Ok(repo) = profile.storage.repository(rid)
+
        && repo.identity_doc()?.is_public()
+
    {
+
        profile.add_inventory(rid, node)?;
+
        term::success!("Inventory updated with {}", term::format::tertiary(rid));
    }

    term::success!(
modified crates/radicle-cli/src/git.rs
@@ -381,10 +381,10 @@ pub fn commit_ssh_fingerprint(path: &Path, sha1: &str) -> Result<Option<String>,
        .transpose()?;

    // We only return a fingerprint if it's not an empty string
-
    if let Some(s) = string {
-
        if !s.is_empty() {
-
            return Ok(Some(s));
-
        }
+
    if let Some(s) = string
+
        && !s.is_empty()
+
    {
+
        return Ok(Some(s));
    }

    Ok(None)
modified crates/radicle-cli/src/terminal.rs
@@ -65,10 +65,10 @@ pub fn fail(error: &anyhow::Error) {
    }

    // Catch common node errors, and offer a hint.
-
    if let Some(e) = error.downcast_ref::<radicle::node::Error>() {
-
        if e.is_connection_err() {
-
            io::hint("to start your node, run `rad node start`.");
-
        }
+
    if let Some(e) = error.downcast_ref::<radicle::node::Error>()
+
        && e.is_connection_err()
+
    {
+
        io::hint("to start your node, run `rad node start`.");
    }
    if let Some(Error::WithHint { hint, .. }) = error.downcast_ref::<Error>() {
        io::hint(hint);
modified crates/radicle-cli/src/terminal/cob.rs
@@ -39,10 +39,10 @@ impl MigrateCallback for MigrateSpinner {
                progress.rows.percentage()
            ));

-
        if progress.is_done() {
-
            if let Some(spinner) = self.spinner.take() {
-
                spinner.finish()
-
            }
+
        if progress.is_done()
+
            && let Some(spinner) = self.spinner.take()
+
        {
+
            spinner.finish()
        }
    }
}
modified crates/radicle-cli/src/terminal/patch/common.rs
@@ -89,10 +89,10 @@ pub fn branches(target: &Oid, repo: &git::raw::Repository) -> anyhow::Result<Vec
        if !r.is_branch() {
            continue;
        }
-
        if let (Some(oid), Some(name)) = (&r.target(), &r.shorthand()) {
-
            if target == oid {
-
                branches.push(name.to_string());
-
            };
+
        if let (Some(oid), Some(name)) = (&r.target(), &r.shorthand())
+
            && target == oid
+
        {
+
            branches.push(name.to_string());
        };
    }
    Ok(branches)
modified crates/radicle-crypto/src/ssh/keystore.rs
@@ -119,12 +119,12 @@ impl Keystore {
            });
        }

-
        if let Some(path_public) = &self.path_public {
-
            if path_public.exists() {
-
                return Err(Error::AlreadyInitialized {
-
                    exists: path_public.to_path_buf(),
-
                });
-
            }
+
        if let Some(path_public) = &self.path_public
+
            && path_public.exists()
+
        {
+
            return Err(Error::AlreadyInitialized {
+
                exists: path_public.to_path_buf(),
+
            });
        }

        // NOTE: If [`PathBuf::parent`] returns `None`,
modified crates/radicle-dag/src/lib.rs
@@ -330,13 +330,13 @@ impl<K: Ord + Copy, V> Dag<K, V> {
        stack.extend(from.dependents.iter());

        while let Some(key) = stack.pop_front() {
-
            if let Some(node) = self.graph.get(&key) {
-
                if visited.insert(key) {
-
                    nodes.push(key);
+
            if let Some(node) = self.graph.get(&key)
+
                && visited.insert(key)
+
            {
+
                nodes.push(key);

-
                    for &neighbour in &node.dependents {
-
                        stack.push_back(neighbour);
-
                    }
+
                for &neighbour in &node.dependents {
+
                    stack.push_back(neighbour);
                }
            }
        }
@@ -351,13 +351,13 @@ impl<K: Ord + Copy, V> Dag<K, V> {
        stack.extend(from.dependencies.iter());

        while let Some(key) = stack.pop_front() {
-
            if let Some(node) = self.graph.get(&key) {
-
                if visited.insert(key) {
-
                    nodes.push(key);
+
            if let Some(node) = self.graph.get(&key)
+
                && visited.insert(key)
+
            {
+
                nodes.push(key);

-
                    for &neighbour in &node.dependencies {
-
                        stack.push_back(neighbour);
-
                    }
+
                for &neighbour in &node.dependencies {
+
                    stack.push_back(neighbour);
                }
            }
        }
modified crates/radicle-git-metadata/src/commit/parse.rs
@@ -155,10 +155,10 @@ fn parse_body(body: &str) -> (String, Vec<OwnedTrailer>) {
    if let Some(split) = body.rfind("\n\n") {
        let candidate = &body[split + 2..];
        // Only treat non-empty paragraphs as trailers.
-
        if !candidate.trim().is_empty() {
-
            if let Some(trailers) = try_parse_trailers(candidate) {
-
                return (body[..split].to_string(), trailers);
-
            }
+
        if !candidate.trim().is_empty()
+
            && let Some(trailers) = try_parse_trailers(candidate)
+
        {
+
            return (body[..split].to_string(), trailers);
        }
    }

modified crates/radicle-node/src/reactor/transport.rs
@@ -301,15 +301,15 @@ impl<S: Session + Source> EventHandler for Transport<S> {

    fn handle(&mut self, event: &Event) -> Vec<Self::Reaction> {
        let mut events = Vec::with_capacity(2);
-
        if event.is_writable() {
-
            if let Some(event) = self.handle_io(Interest::WRITABLE) {
-
                events.push(event);
-
            }
+
        if event.is_writable()
+
            && let Some(event) = self.handle_io(Interest::WRITABLE)
+
        {
+
            events.push(event);
        }
-
        if event.is_readable() {
-
            if let Some(event) = self.handle_io(Interest::READABLE) {
-
                events.push(event);
-
            }
+
        if event.is_readable()
+
            && let Some(event) = self.handle_io(Interest::READABLE)
+
        {
+
            events.push(event);
        }
        events
    }
modified crates/radicle-node/src/runtime/handle.rs
@@ -174,10 +174,10 @@ impl radicle::node::Handle for Handle {
        let sessions = self.sessions()?;
        let session = sessions.iter().find(|s| s.nid == node);

-
        if let Some(s) = session {
-
            if s.state.is_connected() {
-
                return Ok(ConnectResult::Connected);
-
            }
+
        if let Some(s) = session
+
            && s.state.is_connected()
+
        {
+
            return Ok(ConnectResult::Connected);
        }
        self.command(service::Command::Connect(node, addr, opts))?;

modified crates/radicle-node/src/test/node.rs
@@ -249,11 +249,11 @@ impl<G: Signer<Signature> + cyphernet::Ecdh> NodeHandle<G> {
        let events = self.handle.events();

        loop {
-
            if let Ok(repo) = self.storage.repository(*rid) {
-
                if repo.remote(nid).is_ok() {
-
                    log::debug!(target: "test", "Node {} has {rid}/{nid}", self.id);
-
                    break;
-
                }
+
            if let Ok(repo) = self.storage.repository(*rid)
+
                && repo.remote(nid).is_ok()
+
            {
+
                log::debug!(target: "test", "Node {} has {rid}/{nid}", self.id);
+
                break;
            }
            events
                .wait(
modified crates/radicle-node/src/test/peer.rs
@@ -329,22 +329,21 @@ where

    pub fn refs_announcement(&self, rid: RepoId) -> Message {
        let mut refs = BoundedVec::new();
-
        if let Ok(repo) = self.storage().repository(rid) {
-
            if let Ok(false) = repo.is_empty() {
-
                if let Ok(remotes) = repo.remotes() {
-
                    for (remote_id, _) in remotes.into_iter() {
-
                        match RefsAt::new(&repo, remote_id) {
-
                            Ok(refs_at) => {
-
                                if let Err(e) = refs.push(refs_at) {
-
                                    debug!(target: "test", "Failed to push {remote_id} to refs: {e}");
-
                                    break;
-
                                }
-
                            }
-
                            Err(e) => {
-
                                debug!(target: "test", "Failed to get `rad/sigrefs` for {remote_id}: {e}")
-
                            }
+
        if let Ok(repo) = self.storage().repository(rid)
+
            && let Ok(false) = repo.is_empty()
+
            && let Ok(remotes) = repo.remotes()
+
        {
+
            for (remote_id, _) in remotes.into_iter() {
+
                match RefsAt::new(&repo, remote_id) {
+
                    Ok(refs_at) => {
+
                        if let Err(e) = refs.push(refs_at) {
+
                            debug!(target: "test", "Failed to push {remote_id} to refs: {e}");
+
                            break;
                        }
                    }
+
                    Err(e) => {
+
                        debug!(target: "test", "Failed to get `rad/sigrefs` for {remote_id}: {e}")
+
                    }
                }
            }
        }
modified crates/radicle-node/src/test/simulator.rs
@@ -331,7 +331,7 @@ where
        // between individual nodes. We need to think about more realistic
        // scenarios. We should also think about creating various network
        // topologies.
-
        if self.time.as_secs() % 10 == 0 {
+
        if self.time.as_secs().is_multiple_of(10) {
            for (i, x) in nodes.keys().enumerate() {
                for y in nodes.keys().skip(i + 1) {
                    if self.is_fallible() {
modified crates/radicle-node/src/worker/fetch.rs
@@ -186,12 +186,12 @@ fn notify(
                // for sigref verification.
                continue;
            }
-
            if let Some(rest) = r.strip_prefix(git::fmt::refname!("refs/heads/patches")) {
-
                if radicle::cob::ObjectId::from_str(rest.as_str()).is_ok() {
-
                    // Don't notify about patch branches, since we already get
-
                    // notifications about patch updates.
-
                    continue;
-
                }
+
            if let Some(rest) = r.strip_prefix(git::fmt::refname!("refs/heads/patches"))
+
                && radicle::cob::ObjectId::from_str(rest.as_str()).is_ok()
+
            {
+
                // Don't notify about patch branches, since we already get
+
                // notifications about patch updates.
+
                continue;
            }
        }
        if let RefUpdate::Skipped { .. } = update {
modified crates/radicle-protocol/src/service.rs
@@ -464,10 +464,10 @@ where
                continue;
            };
            // Skip this repo if the sync status matches what we have in storage.
-
            if let Some(announced) = announced.get(&rid) {
-
                if updated_at.oid == announced.oid {
-
                    continue;
-
                }
+
            if let Some(announced) = announced.get(&rid)
+
                && updated_at.oid == announced.oid
+
            {
+
                continue;
            }
            // Make sure our local node's sync status is up to date with storage.
            if self.db.seeds_mut().synced(
@@ -1300,16 +1300,14 @@ where
                    self.outbox.write_all(peer, msgs);
                }
                Entry::Vacant(e) => {
-
                    if let HostName::Ip(ip) = addr.host {
-
                        if !address::is_local(&ip) {
-
                            if let Err(e) =
-
                                self.db
-
                                    .addresses_mut()
-
                                    .record_ip(&remote, ip, self.clock.into())
-
                            {
-
                                log::debug!(target: "service", "Failed to record IP address for {remote}: {e}");
-
                            }
-
                        }
+
                    if let HostName::Ip(ip) = addr.host
+
                        && !address::is_local(&ip)
+
                        && let Err(e) =
+
                            self.db
+
                                .addresses_mut()
+
                                .record_ip(&remote, ip, self.clock.into())
+
                    {
+
                        log::debug!(target: "service", "Failed to record IP address for {remote}: {e}");
                    }
                    let peer = e.insert(Session::inbound(
                        remote,
@@ -1811,20 +1809,20 @@ where
                let relayer = remote;
                let relayer_addr = peer.addr.clone();

-
                if let Some(id) = self.handle_announcement(relayer, &relayer_addr, &ann)? {
-
                    if self.config.is_relay() {
-
                        if let AnnouncementMessage::Inventory(_) = ann.message {
-
                            if let Err(e) = self
-
                                .database_mut()
-
                                .gossip_mut()
-
                                .set_relay(id, gossip::RelayStatus::Relay)
-
                            {
-
                                warn!(target: "service", "Failed to set relay flag for message: {e}");
-
                                return Ok(());
-
                            }
-
                        } else {
-
                            self.relay(id, ann);
+
                if let Some(id) = self.handle_announcement(relayer, &relayer_addr, &ann)?
+
                    && self.config.is_relay()
+
                {
+
                    if let AnnouncementMessage::Inventory(_) = ann.message {
+
                        if let Err(e) = self
+
                            .database_mut()
+
                            .gossip_mut()
+
                            .set_relay(id, gossip::RelayStatus::Relay)
+
                        {
+
                            warn!(target: "service", "Failed to set relay flag for message: {e}");
+
                            return Ok(());
                        }
+
                    } else {
+
                        self.relay(id, ann);
                    }
                }
            }
@@ -1876,20 +1874,18 @@ where
                );
            }
            Message::Pong { zeroes } => {
-
                if let Some((ping, latencies)) = connected {
-
                    if let session::PingState::AwaitingResponse {
+
                if let Some((ping, latencies)) = connected
+
                    && let session::PingState::AwaitingResponse {
                        len: ponglen,
                        since,
                    } = *ping
-
                    {
-
                        if (ponglen as usize) == zeroes.len() {
-
                            *ping = session::PingState::Ok;
-
                            // Keep track of peer latency.
-
                            latencies.push_back(self.clock - since);
-
                            if latencies.len() > MAX_LATENCIES {
-
                                latencies.pop_front();
-
                            }
-
                        }
+
                    && (ponglen as usize) == zeroes.len()
+
                {
+
                    *ping = session::PingState::Ok;
+
                    // Keep track of peer latency.
+
                    latencies.push_back(self.clock - since);
+
                    if latencies.len() > MAX_LATENCIES {
+
                        latencies.pop_front();
                    }
                }
            }
@@ -1929,11 +1925,11 @@ where

    /// Add a seed to our routing table.
    fn seed_discovered(&mut self, rid: RepoId, nid: NodeId, time: Timestamp) {
-
        if let Ok(result) = self.db.routing_mut().add_inventory([&rid], nid, time) {
-
            if let &[(_, InsertResult::SeedAdded)] = result.as_slice() {
-
                self.emitter.emit(Event::SeedDiscovered { rid, nid });
-
                debug!(target: "service", "Routing table updated for {rid} with seed {nid}");
-
            }
+
        if let Ok(result) = self.db.routing_mut().add_inventory([&rid], nid, time)
+
            && let &[(_, InsertResult::SeedAdded)] = result.as_slice()
+
        {
+
            self.emitter.emit(Event::SeedDiscovered { rid, nid });
+
            debug!(target: "service", "Routing table updated for {rid} with seed {nid}");
        }
    }

modified crates/radicle-protocol/src/service/limiter.rs
@@ -36,10 +36,10 @@ impl RateLimiter {
        tokens: &T,
        now: LocalTime,
    ) -> bool {
-
        if let Some(nid) = nid {
-
            if self.bypass.contains(nid) {
-
                return false;
-
            }
+
        if let Some(nid) = nid
+
            && self.bypass.contains(nid)
+
        {
+
            return false;
        }
        if let HostName::Ip(ip) = addr {
            // Don't limit LAN addresses.
modified crates/radicle-protocol/src/service/session.rs
@@ -218,12 +218,12 @@ impl Session {
            ref mut stable,
            ..
        } = self.state
+
            && now >= since
+
            && now.duration_since(since) >= CONNECTION_STABLE_THRESHOLD
        {
-
            if now >= since && now.duration_since(since) >= CONNECTION_STABLE_THRESHOLD {
-
                *stable = true;
-
                // Reset number of attempts for stable connections.
-
                self.attempts = 0;
-
            }
+
            *stable = true;
+
            // Reset number of attempts for stable connections.
+
            self.attempts = 0;
        }
    }

modified crates/radicle-remote-helper/src/main.rs
@@ -245,10 +245,10 @@ fn run(profile: radicle::Profile) -> Result<(), Error> {
    let git = service::RealGitService;
    let mut node = service::RealNodeSession::new(&profile);

-
    if let Err(e) = radicle::io::set_file_limit(4096) {
-
        if debug {
-
            eprintln!("{}: unable to set open file limit: {e}", VERSION.name);
-
        }
+
    if let Err(e) = radicle::io::set_file_limit(4096)
+
        && debug
+
    {
+
        eprintln!("{}: unable to set open file limit: {e}", VERSION.name);
    }

    run_loop(
modified crates/radicle-remote-helper/src/push.rs
@@ -662,17 +662,15 @@ where
        // Set up current branch so that pushing updates the patch.
        else if let Some(branch) =
            rad::setup_patch_upstream(&patch, *head, working, upstream, false)?
+
            && let Some(name) = branch.name()?
+
            && profile.hints()
        {
-
            if let Some(name) = branch.name()? {
-
                if profile.hints() {
-
                    // Remove the remote portion of the name, i.e.
-
                    // rad/patches/deadbeef -> patches/deadbeef
-
                    let name = name.split_once('/').unwrap_or_default().1;
-
                    hint(format!(
-
                        "to update, run `git push` or `git push {upstream} --force-with-lease HEAD:{name}`"
-
                    ));
-
                }
-
            }
+
            // Remove the remote portion of the name, i.e.
+
            // rad/patches/deadbeef -> patches/deadbeef
+
            let name = name.split_once('/').unwrap_or_default().1;
+
            hint(format!(
+
                "to update, run `git push` or `git push {upstream} --force-with-lease HEAD:{name}`"
+
            ));
        }
    }

modified crates/radicle-term/src/editor.rs
@@ -204,15 +204,15 @@ impl Editor {
/// Get the default editor command.
fn default_editor() -> Option<OsString> {
    // First check the standard environment variables.
-
    if let Ok(visual) = env::var("VISUAL") {
-
        if !visual.is_empty() {
-
            return Some(visual.into());
-
        }
+
    if let Ok(visual) = env::var("VISUAL")
+
        && !visual.is_empty()
+
    {
+
        return Some(visual.into());
    }
-
    if let Ok(editor) = env::var("EDITOR") {
-
        if !editor.is_empty() {
-
            return Some(editor.into());
-
        }
+
    if let Ok(editor) = env::var("EDITOR")
+
        && !editor.is_empty()
+
    {
+
        return Some(editor.into());
    }

    // Check Git. The user might have configured their editor there.
modified crates/radicle-term/src/spinner.rs
@@ -59,10 +59,10 @@ pub struct Spinner {

impl Drop for Spinner {
    fn drop(&mut self) {
-
        if let Ok(mut progress) = self.progress.lock() {
-
            if let State::Running = progress.state {
-
                progress.state = State::Canceled;
-
            }
+
        if let Ok(mut progress) = self.progress.lock()
+
            && let State::Running = progress.state
+
        {
+
            progress.state = State::Canceled;
        }

        unsafe { ManuallyDrop::take(&mut self.handle) }
modified crates/radicle/src/cob/cache/migrations/2.rs
@@ -48,11 +48,11 @@ pub fn run(
                .ok_or(Error::MalformedJsonSchema)?;

            for (_, review) in reviews.iter_mut() {
-
                if let Some(list) = review.as_array_mut() {
-
                    if let Some(last) = list.pop() {
-
                        *review = last;
-
                        transformed = true;
-
                    }
+
                if let Some(list) = review.as_array_mut()
+
                    && let Some(last) = list.pop()
+
                {
+
                    *review = last;
+
                    transformed = true;
                }
            }
        }
modified crates/radicle/src/cob/patch.rs
@@ -726,10 +726,10 @@ impl Patch {
                review, comment, ..
            }
            | Action::ReviewCommentRedact { review, comment } => {
-
                if let Some((_, review)) = lookup::review(self, review)? {
-
                    if let Some(comment) = review.comments.comment(comment) {
-
                        return Ok(Authorization::from(*actor == comment.author()));
-
                    }
+
                if let Some((_, review)) = lookup::review(self, review)?
+
                    && let Some(comment) = review.comments.comment(comment)
+
                {
+
                    return Ok(Authorization::from(*actor == comment.author()));
                }
                // Redacted.
                Authorization::Unknown
@@ -739,14 +739,14 @@ impl Patch {
            // The reviewer, commenter or revision author can resolve and unresolve review comments.
            Action::ReviewCommentResolve { review, comment }
            | Action::ReviewCommentUnresolve { review, comment } => {
-
                if let Some((revision, review)) = lookup::review(self, review)? {
-
                    if let Some(comment) = review.comments.comment(comment) {
-
                        return Ok(Authorization::from(
-
                            actor == &comment.author()
-
                                || actor == review.author.public_key()
-
                                || actor == revision.author.public_key(),
-
                        ));
-
                    }
+
                if let Some((revision, review)) = lookup::review(self, review)?
+
                    && let Some(comment) = review.comments.comment(comment)
+
                {
+
                    return Ok(Authorization::from(
+
                        actor == &comment.author()
+
                            || actor == review.author.public_key()
+
                            || actor == revision.author.public_key(),
+
                    ));
                }
                // Redacted.
                Authorization::Unknown
@@ -773,10 +773,10 @@ impl Patch {
            | Action::RevisionCommentRedact {
                revision, comment, ..
            } => {
-
                if let Some(revision) = lookup::revision(self, revision)? {
-
                    if let Some(comment) = revision.discussion.comment(comment) {
-
                        return Ok(Authorization::from(actor == &comment.author()));
-
                    }
+
                if let Some(revision) = lookup::revision(self, revision)?
+
                    && let Some(comment) = revision.discussion.comment(comment)
+
                {
+
                    return Ok(Authorization::from(actor == &comment.author()));
                }
                // Redacted.
                Authorization::Unknown
modified crates/radicle/src/cob/thread.rs
@@ -399,10 +399,10 @@ impl<L> Thread<Comment<L>> {
        to: &'a CommentId,
    ) -> impl Iterator<Item = (&'a CommentId, &'a Comment<L>)> {
        self.comments().filter_map(move |(id, c)| {
-
            if let Some(reply_to) = c.reply_to {
-
                if &reply_to == to {
-
                    return Some((id, c));
-
                }
+
            if let Some(reply_to) = c.reply_to
+
                && &reply_to == to
+
            {
+
                return Some((id, c));
            }
            None
        })
@@ -503,10 +503,10 @@ pub fn comment<L>(
    if body.is_empty() {
        return Err(Error::Comment(id));
    }
-
    if let Some(id) = reply_to {
-
        if !thread.comments.contains_key(&id) {
-
            return Err(Error::Missing(id));
-
        }
+
    if let Some(id) = reply_to
+
        && !thread.comments.contains_key(&id)
+
    {
+
        return Err(Error::Missing(id));
    }
    debug_assert!(!thread.timeline.contains(&id));
    thread.timeline.push(id);
modified crates/radicle/src/git/canonical/symbolic.rs
@@ -347,19 +347,19 @@ impl SymbolicRefs {

        // A [`Target::Direct`] whose string is already a key is actually
        // an intermediate link — downgrade to [`Target::Symbolic`].
-
        if let Target::Direct(q) = &target {
-
            if self.0.contains_key(&q.as_ref().to_ref_string()) {
-
                target = Target::symbolic(q.to_ref_string());
-
            }
+
        if let Target::Direct(q) = &target
+
            && self.0.contains_key(&q.as_ref().to_ref_string())
+
        {
+
            target = Target::symbolic(q.to_ref_string());
        }

-
        if let Target::Symbolic(s) = &target {
-
            if self.resolve(s.as_ref()).is_none() {
-
                return Err(InsertionError::TargetNotQualified {
-
                    name: name.into_inner(),
-
                    target: target_str,
-
                });
-
            }
+
        if let Target::Symbolic(s) = &target
+
            && self.resolve(s.as_ref()).is_none()
+
        {
+
            return Err(InsertionError::TargetNotQualified {
+
                name: name.into_inner(),
+
                target: target_str,
+
            });
        }

        self.reclassify_targets(&name);
@@ -373,10 +373,10 @@ impl SymbolicRefs {
    fn reclassify_targets(&mut self, new_key: &Name) {
        let key = new_key.as_ref();
        for existing in self.0.values_mut() {
-
            if let Target::Direct(q) = existing {
-
                if q == key {
-
                    *existing = Target::symbolic(q.to_ref_string());
-
                }
+
            if let Target::Direct(q) = existing
+
                && q == key
+
            {
+
                *existing = Target::symbolic(q.to_ref_string());
            }
        }
    }
modified crates/radicle/src/profile.rs
@@ -91,10 +91,10 @@ pub mod env {
        // because of the complexity surrounding how the pager command is
        // parsed and executed. See also <https://stackoverflow.com/a/773973/1835188>.
        #[cfg(not(windows))]
-
        if let Ok(cfg) = crate::git::raw::Config::open_default() {
-
            if let Ok(pager) = cfg.get_string("core.pager") {
-
                return Some(pager);
-
            }
+
        if let Ok(cfg) = crate::git::raw::Config::open_default()
+
            && let Ok(pager) = cfg.get_string("core.pager")
+
        {
+
            return Some(pager);
        }
        if let Ok(pager) = var("PAGER") {
            return Some(pager);
modified crates/radicle/src/profile/config.rs
@@ -187,18 +187,18 @@ impl Config {

        // Handle deprecated policy configuration.
        // Nb. This will override "seedingPolicy" if set! This code should be removed after 1.0.
-
        if let (Some(p), Some(s)) = (cfg.node.extra.get("policy"), cfg.node.extra.get("scope")) {
-
            if let (Ok(policy), Ok(scope)) = (
+
        if let (Some(p), Some(s)) = (cfg.node.extra.get("policy"), cfg.node.extra.get("scope"))
+
            && let (Ok(policy), Ok(scope)) = (
                json::from_value::<Policy>(p.clone()),
                json::from_value::<Scope>(s.clone()),
-
            ) {
-
                log::warn!(target: "radicle", "Overwriting `seedingPolicy` configuration");
-
                cfg.node.seeding_policy = match policy {
-
                    Policy::Allow => DefaultSeedingPolicy::Allow {
-
                        scope: node::config::Scope::explicit(scope),
-
                    },
-
                    Policy::Block => DefaultSeedingPolicy::Block,
-
                }
+
            )
+
        {
+
            log::warn!(target: "radicle", "Overwriting `seedingPolicy` configuration");
+
            cfg.node.seeding_policy = match policy {
+
                Policy::Allow => DefaultSeedingPolicy::Allow {
+
                    scope: node::config::Scope::explicit(scope),
+
                },
+
                Policy::Block => DefaultSeedingPolicy::Block,
            }
        }
        Ok(cfg)
modified crates/radicle/src/rad.rs
@@ -85,10 +85,10 @@ where
            if let Err(e) = project.remove() {
                log::warn!(target: "radicle", "Failed to remove project during `rad::init` cleanup: {e}");
            }
-
            if repo.find_remote(&REMOTE_NAME).is_ok() {
-
                if let Err(e) = repo.remote_delete(&REMOTE_NAME) {
-
                    log::warn!(target: "radicle", "Failed to remove remote during `rad::init` cleanup: {e}");
-
                }
+
            if repo.find_remote(&REMOTE_NAME).is_ok()
+
                && let Err(e) = repo.remote_delete(&REMOTE_NAME)
+
            {
+
                log::warn!(target: "radicle", "Failed to remove remote during `rad::init` cleanup: {e}");
            }
            Err(err)
        }
@@ -497,10 +497,10 @@ pub fn setup_patch_upstream<'a>(
    )?;
    assert!(remote_branch.is_remote());

-
    if let Some(name) = name {
-
        if force || branch.upstream().is_err() {
-
            git::set_upstream(working, remote, name.as_str(), git::refs::patch(patch))?;
-
        }
+
    if let Some(name) = name
+
        && (force || branch.upstream().is_err())
+
    {
+
        git::set_upstream(working, remote, name.as_str(), git::refs::patch(patch))?;
    }
    Ok(Some(crate::git::raw::Branch::wrap(remote_branch)))
}
modified crates/radicle/src/storage/git.rs
@@ -842,10 +842,10 @@ impl ReadRepository for Repository {

    fn head(&self) -> Result<(Qualified<'_>, Oid), RepositoryError> {
        // If `HEAD` is already set locally, just return that.
-
        if let Ok(head) = self.backend.head() {
-
            if let Ok((name, oid)) = git::refs::qualified_from(&head) {
-
                return Ok((name.to_owned(), oid));
-
            }
+
        if let Ok(head) = self.backend.head()
+
            && let Ok((name, oid)) = git::refs::qualified_from(&head)
+
        {
+
            return Ok((name.to_owned(), oid));
        }
        self.canonical_head()
    }
modified crates/radicle/src/test.rs
@@ -34,12 +34,12 @@ pub fn fetch<W: WriteRepository>(
    };

    callbacks.update_tips(|name, old, new| {
-
        if let Ok(name) = git::fmt::RefString::try_from(name) {
-
            if name.to_namespaced().is_some() {
-
                updates.push(RefUpdate::from(name, old, new));
-
                // Returning `true` ensures the process is not aborted.
-
                return true;
-
            }
+
        if let Ok(name) = git::fmt::RefString::try_from(name)
+
            && name.to_namespaced().is_some()
+
        {
+
            updates.push(RefUpdate::from(name, old, new));
+
            // Returning `true` ensures the process is not aborted.
+
            return true;
        }
        false
    });