Radish alpha
h
rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5
Radicle Heartwood Protocol & Stack
Radicle
Git
Some misc cleanup patches
Merged did:key:z6MkwcUR...q1kL opened 8 months ago
4 files changed +12 -12 0200e84a 77f63c76
modified crates/radicle-cli/src/commands/clone.rs
@@ -244,12 +244,10 @@ impl Checkout {
        let proj = doc
            .project()
            .map_err(|err| CheckoutFailure::Payload { rid, err })?;
-
        let path = directory.unwrap_or(Path::new(proj.name()).to_path_buf());
+
        let path = directory.unwrap_or_else(|| PathBuf::from(proj.name()));
        // N.b. fail if the path exists and is not empty
-
        if path.exists() {
-
            if path.read_dir().map_or(true, |mut dir| dir.next().is_some()) {
-
                return Err(CheckoutFailure::Exists { rid, path });
-
            }
+
        if path.exists() && path.read_dir().map_or(true, |mut dir| dir.next().is_some()) {
+
            return Err(CheckoutFailure::Exists { rid, path });
        }

        Ok(Self {
modified crates/radicle-cli/src/git.rs
@@ -58,7 +58,7 @@ impl Rev {

impl Display for Rev {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
-
        write!(f, "{}", self.0)
+
        self.0.fmt(f)
    }
}

modified crates/radicle-node/src/worker.rs
@@ -92,12 +92,14 @@ impl Worker {
        }
    }

-
    fn process(&mut self, task: Task) {
-
        let Task {
+
    fn process(
+
        &mut self,
+
        Task {
            fetch,
            channels,
            stream,
-
        } = task;
+
        }: Task,
+
    ) {
        let remote = fetch.remote();
        let channels = channels::ChannelsFlush::new(self.handle.clone(), channels, remote, stream);
        let result = self._process(fetch, stream, channels, self.notifications.clone());
@@ -167,7 +169,7 @@ impl Worker {
                    stream_w,
                    timeout,
                )
-
                .map(|_| ())
+
                .map(drop)
                .map_err(UploadError::UploadPack);
                log::debug!(target: "worker", "Upload process on stream {stream} exited with result {result:?}");

modified crates/radicle/src/cob/common.rs
@@ -64,7 +64,7 @@ impl Author {

impl Display for Author {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-
        write!(f, "{}", self.id)
+
        self.id.fmt(f)
    }
}

@@ -210,7 +210,7 @@ impl FromStr for Label {

impl Display for Label {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-
        write!(f, "{}", self.0)
+
        self.0.fmt(f)
    }
}