Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
Upgrade Rust to 1.66
Alexis Sellier committed 3 years ago
commit f26674a5a9745b3e11fd297a5a2fbfdbb1d49904
parent b32ae984ce87dba7f5732aa3c5119e0791d45190
23 files changed +44 -45
modified .github/workflows/actions.yml
@@ -15,7 +15,7 @@ jobs:
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
-
          toolchain: 1.65
+
          toolchain: 1.66
      - name: Build
        run: cargo build --verbose --all-features
        env:
@@ -43,7 +43,7 @@ jobs:
        with:
          profile: minimal
          components: clippy, rustfmt
-
          toolchain: 1.65
+
          toolchain: 1.66
      - name: Cache cargo registry
        uses: actions/cache@v1
        with:
modified radicle-cli/src/commands/auth.rs
@@ -85,13 +85,13 @@ pub fn init(options: Options) -> anyhow::Result<()> {

    term::success!(
        "Profile {} created.",
-
        term::format::highlight(&profile.id().to_string())
+
        term::format::highlight(profile.id().to_string())
    );

    term::blank();
    term::info!(
        "Your radicle Node ID is {}. This identifies your device.",
-
        term::format::highlight(&profile.id().to_string())
+
        term::format::highlight(profile.id().to_string())
    );

    term::blank();
modified radicle-cli/src/commands/checkout.rs
@@ -139,7 +139,7 @@ pub fn setup_remotes(setup: project::SetupRemote, remotes: &[NodeId]) -> anyhow:
            term::success!("Remote {} set", term::format::highlight(remote));
            term::success!(
                "Remote-tracking branch {} created for {}",
-
                term::format::highlight(&branch),
+
                term::format::highlight(branch),
                term::format::tertiary(term::format::node(remote_id))
            );
        }
modified radicle-cli/src/commands/init.rs
@@ -155,7 +155,7 @@ pub fn init(options: Options, profile: &profile::Profile) -> anyhow::Result<()>
        if path == cwd {
            term::format::highlight(".")
        } else {
-
            term::format::highlight(&path.display())
+
            term::format::highlight(path.display())
        }
    ));

@@ -271,7 +271,7 @@ pub fn setup_signing(
        ));
        true
    } else if interactive.yes() {
-
        term::confirm(&format!(
+
        term::confirm(format!(
            "Configure 🌱 signing key {} in local checkout?",
            term::format::tertiary(key),
        ))
@@ -296,7 +296,7 @@ pub fn setup_signing(

                if ssh_keys.contains(&ssh_key) {
                    term::success!("Signing key is already in {} file", gitsigners);
-
                } else if term::confirm(&format!("Add signing key to {}?", gitsigners)) {
+
                } else if term::confirm(format!("Add signing key to {}?", gitsigners)) {
                    git::add_gitsigners(repo, [node_id])?;
                }
            }
modified radicle-cli/src/commands/inspect.rs
@@ -150,7 +150,7 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
        let repo = storage.repository(id)?;
        let head = Doc::<Untrusted>::head(signer.public_key(), &repo)?;
        let history = repo.revwalk(head)?.collect::<Vec<_>>();
-
        let revision = history.len() as usize;
+
        let revision = history.len();

        for (counter, oid) in history.into_iter().rev().enumerate() {
            let oid = oid?.into();
modified radicle-cli/src/commands/patch/create.rs
@@ -177,11 +177,11 @@ pub fn run(
    term::info!(
        "{}/{} ({}) <- {}/{} ({})",
        term::format::dim(target_peer.id),
-
        term::format::highlight(&project.default_branch.to_string()),
-
        term::format::secondary(&term::format::oid(*target_oid)),
+
        term::format::highlight(project.default_branch.to_string()),
+
        term::format::secondary(term::format::oid(*target_oid)),
        term::format::dim(term::format::node(patches.public_key())),
-
        term::format::highlight(&head_branch.to_string()),
-
        term::format::secondary(&term::format::oid(head_oid)),
+
        term::format::highlight(head_branch.to_string()),
+
        term::format::secondary(term::format::oid(head_oid)),
    );

    // TODO: Test case where the target branch has been re-written passed the merge-base, since the fork was created
@@ -223,7 +223,7 @@ pub fn run(
    }

    term::blank();
-
    term::print(&term::format::dim(format!(
+
    term::print(term::format::dim(format!(
        "╰{}",
        "─".repeat(term::text_width(title_pretty) - 1)
    )));
modified radicle-cli/src/commands/patch/list.rs
@@ -39,11 +39,11 @@ pub fn run(
        }
    }
    term::blank();
-
    term::print(&term::format::badge_positive("YOU PROPOSED"));
+
    term::print(term::format::badge_positive("YOU PROPOSED"));

    if own.is_empty() {
        term::blank();
-
        term::print(&term::format::italic("Nothing to show."));
+
        term::print(term::format::italic("Nothing to show."));
    } else {
        for (id, patch) in &mut own {
            term::blank();
@@ -52,11 +52,11 @@ pub fn run(
        }
    }
    term::blank();
-
    term::print(&term::format::badge_secondary("OTHERS PROPOSED"));
+
    term::print(term::format::badge_secondary("OTHERS PROPOSED"));

    if other.is_empty() {
        term::blank();
-
        term::print(&term::format::italic("Nothing to show."));
+
        term::print(term::format::italic("Nothing to show."));
    } else {
        for (id, patch) in &mut other {
            term::blank();
modified radicle-cli/src/commands/push.rs
@@ -122,10 +122,10 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
    }
    args.push("rad"); // Push to "rad" remote.

-
    term::subcommand(&format!("git {}", args.join(" ")));
+
    term::subcommand(format!("git {}", args.join(" ")));

    // Push to storage.
-
    match git::run::<_, _, &str, &str>(&cwd, args, []) {
+
    match git::run::<_, _, &str, &str>(cwd, args, []) {
        Ok(output) => term::blob(output),
        Err(err) => return Err(err.into()),
    }
modified radicle-cli/src/commands/rm.rs
@@ -81,7 +81,7 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
    let id = options.id;

    if let Ok(Some(_)) = storage.get(signer.public_key(), id.to_owned()) {
-
        let namespace = profile.paths().storage().join(&id.to_human());
+
        let namespace = profile.paths().storage().join(id.to_human());

        if !options.confirm
            || term::confirm(format!(
modified radicle-cli/src/commands/track.rs
@@ -94,11 +94,11 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
    let storage = &profile.storage;
    let (_, rid) = radicle::rad::cwd().context("this command must be run within a project")?;
    let project = storage.repository(rid)?.project_of(profile.id())?;
-
    let mut node = radicle::node::connect(&profile.node())?;
+
    let mut node = radicle::node::connect(profile.node())?;

    term::info!(
        "Establishing 🌱 tracking relationship for {}",
-
        term::format::highlight(&project.name)
+
        term::format::highlight(project.name)
    );
    term::blank();

modified radicle-cli/src/main.rs
@@ -23,7 +23,7 @@ fn main() {
        Ok(_) => process::exit(0),
        Err(err) => {
            if let Some(err) = err {
-
                term::error(&format!("Error: rad: {}", err));
+
                term::error(format!("Error: rad: {}", err));
            }
            process::exit(1);
        }
modified radicle-cli/src/terminal/table.rs
@@ -14,20 +14,22 @@ pub struct Table<const W: usize> {
    opts: TableOptions,
}

-
impl<const W: usize> Table<W> {
-
    pub fn new(opts: TableOptions) -> Self {
+
impl<const W: usize> Default for Table<W> {
+
    fn default() -> Self {
        Self {
            rows: Vec::new(),
            widths: [0; W],
-
            opts,
+
            opts: TableOptions::default(),
        }
    }
+
}

-
    pub fn default() -> Self {
+
impl<const W: usize> Table<W> {
+
    pub fn new(opts: TableOptions) -> Self {
        Self {
            rows: Vec::new(),
            widths: [0; W],
-
            opts: TableOptions::default(),
+
            opts,
        }
    }

modified radicle-crypto/src/test/arbitrary.rs
@@ -25,6 +25,6 @@ impl Arbitrary for PublicKey {
impl Arbitrary for hash::Digest {
    fn arbitrary(g: &mut qcheck::Gen) -> Self {
        let bytes: Vec<u8> = Arbitrary::arbitrary(g);
-
        hash::Digest::new(&bytes)
+
        hash::Digest::new(bytes)
    }
}
modified radicle-node/src/address/store.rs
@@ -326,7 +326,7 @@ mod test {
    fn test_empty() {
        let tmp = tempfile::tempdir().unwrap();
        let path = tmp.path().join("cache");
-
        let cache = Book::open(&path).unwrap();
+
        let cache = Book::open(path).unwrap();

        assert!(cache.is_empty().unwrap());
    }
modified radicle-node/src/service/message.rs
@@ -294,7 +294,7 @@ impl Announcement {
    /// Verify this announcement's signature.
    pub fn verify(&self) -> bool {
        let msg = wire::serialize(&self.message);
-
        self.node.verify(&msg, &self.signature).is_ok()
+
        self.node.verify(msg, &self.signature).is_ok()
    }

    pub fn matches(&self, filter: &Filter) -> bool {
modified radicle-node/src/wire.rs
@@ -126,10 +126,7 @@ impl Encode for PublicKey {

impl<const T: usize> Encode for &[u8; T] {
    fn encode<W: io::Write + ?Sized>(&self, writer: &mut W) -> Result<usize, io::Error> {
-
        // TODO: This can be removed when the clippy bugs are fixed
-
        #[allow(clippy::explicit_auto_deref)]
-
        writer.write_all(*self)?;
-

+
        writer.write_all(&**self)?;
        Ok(mem::size_of::<Self>())
    }
}
modified radicle-remote-helper/src/lib.rs
@@ -108,7 +108,7 @@ pub fn run(profile: radicle::Profile) -> Result<(), Box<dyn std::error::Error +
                        // Connect to local node and announce refs to the network.
                        // If our node is not running, we simply skip this step, as the
                        // refs will be announced eventually, when the node restarts.
-
                        if let Ok(mut conn) = radicle::node::connect(&profile.node()) {
+
                        if let Ok(mut conn) = radicle::node::connect(profile.node()) {
                            conn.announce_refs(url.repo)?;
                        }
                    }
modified radicle-tools/src/rad-push.rs
@@ -16,7 +16,7 @@ fn main() -> anyhow::Result<()> {
    let sigrefs = project.sign_refs(&signer)?;
    let head = project.set_head()?;

-
    radicle::node::connect(&profile.node())?.announce_refs(id)?;
+
    radicle::node::connect(profile.node())?.announce_refs(id)?;

    println!("head: {}", head);
    println!("ok: {}", sigrefs.signature);
modified radicle/src/profile.rs
@@ -59,7 +59,7 @@ pub struct Profile {
impl Profile {
    pub fn init(home: impl AsRef<Path>, passphrase: &str) -> Result<Self, Error> {
        let home = home.as_ref().to_path_buf();
-
        let storage = Storage::open(&home.join("storage"))?;
+
        let storage = Storage::open(home.join("storage"))?;
        let keystore = Keystore::new(&home.join("keys"));
        let public_key = keystore.init("radicle", passphrase)?;

@@ -75,7 +75,7 @@ impl Profile {

    pub fn load() -> Result<Self, Error> {
        let home = self::home()?;
-
        let storage = Storage::open(&home.join("storage"))?;
+
        let storage = Storage::open(home.join("storage"))?;
        let keystore = Keystore::new(&home.join("keys"));
        let public_key = keystore
            .public_key()?
modified radicle/src/rad.rs
@@ -392,7 +392,7 @@ mod tests {
        let (_, head) = project_repo.head().unwrap();

        // Test canonical refs.
-
        assert_eq!(refs.head(&component!("master")).unwrap(), head);
+
        assert_eq!(refs.head(component!("master")).unwrap(), head);
        assert_eq!(project_repo.raw().refname_to_id("HEAD").unwrap(), *head);
        assert_eq!(
            project_repo
modified radicle/src/storage/git.rs
@@ -1059,7 +1059,7 @@ mod tests {
        let addr = socket.local_addr().unwrap();
        let source_path = tmp.path().join("source");
        let target_path = tmp.path().join("target");
-
        let (source, _) = fixtures::repository(&source_path);
+
        let (source, _) = fixtures::repository(source_path);

        transport::local::register(storage.clone());

modified radicle/src/storage/refs.rs
@@ -76,7 +76,7 @@ impl Refs {
        let refs = self;
        let msg = refs.canonical();

-
        match signer.verify(&msg, &signature) {
+
        match signer.verify(msg, &signature) {
            Ok(()) => Ok(SignedRefs {
                refs,
                signature,
@@ -230,7 +230,7 @@ impl SignedRefs<Unverified> {
    pub fn verify(&self, signer: &PublicKey) -> Result<(), crypto::Error> {
        let canonical = self.refs.canonical();

-
        match signer.verify(&canonical, &self.signature) {
+
        match signer.verify(canonical, &self.signature) {
            Ok(()) => Ok(()),
            Err(e) => Err(e),
        }
modified rust-toolchain
@@ -1 +1 @@
-
1.65
+
1.66