Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
Update to Rust 1.65
Alexis Sellier committed 3 years ago
commit 45c7f3049b1816613624a22198ca01366db8c6b2
parent f3c4a53e1eb50cd9f6fbf8eb82778bde397ee92e
12 files changed +17 -23
modified .github/workflows/actions.yml
@@ -15,6 +15,7 @@ jobs:
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
+
          toolchain: 1.65
      - name: Build
        run: cargo build --verbose --all-features
        env:
@@ -42,7 +43,7 @@ jobs:
        with:
          profile: minimal
          components: clippy, rustfmt
-
          toolchain: 1.64
+
          toolchain: 1.65
      - name: Cache cargo registry
        uses: actions/cache@v1
        with:
modified radicle-crypto/src/lib.rs
@@ -285,7 +285,7 @@ impl PublicKey {
        buf[..2].copy_from_slice(&Self::MULTICODEC_TYPE);
        buf[2..].copy_from_slice(self.0.deref());

-
        multibase::encode(multibase::Base::Base58Btc, &buf)
+
        multibase::encode(multibase::Base::Base58Btc, buf)
    }
}

modified radicle-crypto/src/ssh/keystore.rs
@@ -48,7 +48,7 @@ impl Keystore {
    /// The `passphrase` is used to encrypt the private key.
    pub fn init(&self, comment: &str, passphrase: &str) -> Result<PublicKey, Error> {
        let pair = KeyPair::generate();
-
        let ssh_pair = ssh_key::private::Ed25519Keypair::from_bytes(&*pair)?;
+
        let ssh_pair = ssh_key::private::Ed25519Keypair::from_bytes(&pair)?;
        let ssh_pair = ssh_key::private::KeypairData::Ed25519(ssh_pair);
        let secret = ssh_key::PrivateKey::new(ssh_pair, comment)?;
        let secret = secret.encrypt(ssh_key::rand_core::OsRng, passphrase)?;
modified radicle-node/src/service.rs
@@ -417,9 +417,7 @@ where
                }

                let seeds = self.seeds(&id);
-
                let seeds = if let Some(seeds) = NonEmpty::from_vec(seeds) {
-
                    seeds
-
                } else {
+
                let Some(seeds) = NonEmpty::from_vec(seeds) else {
                    log::error!("No seeds found for {}", id);
                    resp.send(FetchLookup::NotFound).ok();

@@ -755,9 +753,7 @@ where
        message: Message,
    ) -> Result<(), session::Error> {
        let peer_ip = remote.ip();
-
        let peer = if let Some(peer) = self.sessions.get_mut(&peer_ip) {
-
            peer
-
        } else {
+
        let Some(peer) = self.sessions.get_mut(&peer_ip) else {
            return Err(session::Error::NotFound(remote.ip()));
        };
        peer.last_active = self.clock.local_time();
modified radicle-node/src/test/simulator.rs
@@ -560,13 +560,11 @@ impl<S: WriteStorage + 'static, G: Signer> Simulation<S, G> {
                //
                // It's also possible that the connection was only attempted and never succeeded,
                // in which case we would return here.
-
                let port = if let Some(port) = self.connections.get(&(node, remote.ip())) {
-
                    *port
-
                } else {
+
                let Some(port) = self.connections.get(&(node, remote.ip())) else {
                    debug!(target: "sim", "Ignoring disconnect of {remote} from {node}");
                    return;
                };
-
                let local_addr: net::SocketAddr = (node, port).into();
+
                let local_addr: net::SocketAddr = (node, *port).into();
                let latency = self.latency(node, remote.ip());

                // The remote node receives the disconnection with some delay.
modified radicle-node/src/wire.rs
@@ -129,6 +129,8 @@ 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)?;

        Ok(mem::size_of::<Self>())
modified radicle-ssh/src/agent/client.rs
@@ -63,9 +63,7 @@ pub trait ClientStream: Sized + Send + Sync {
        P: AsRef<Path> + Send;

    fn connect_env() -> Result<AgentClient<Self>, Error> {
-
        let var = if let Ok(var) = std::env::var("SSH_AUTH_SOCK") {
-
            var
-
        } else {
+
        let Ok(var) = std::env::var("SSH_AUTH_SOCK") else {
            return Err(Error::EnvVar("SSH_AUTH_SOCK"));
        };
        match Self::connect(var) {
modified radicle-ssh/src/encoding.rs
@@ -103,7 +103,7 @@ impl Encoding for Vec<u8> {

    fn extend_list<'a, I: Iterator<Item = &'a [u8]>>(&mut self, list: I) {
        let len0 = self.len();
-
        self.extend(&[0, 0, 0, 0]);
+
        self.extend([0, 0, 0, 0]);

        let mut first = true;
        for i in list {
@@ -120,7 +120,7 @@ impl Encoding for Vec<u8> {
    }

    fn write_empty_list(&mut self) {
-
        self.extend(&[0, 0, 0, 0]);
+
        self.extend([0, 0, 0, 0]);
    }

    fn write_len(&mut self) {
modified radicle-tools/src/rad-push.rs
@@ -8,7 +8,7 @@ fn main() -> anyhow::Result<()> {
    let profile = radicle::Profile::load()?;
    let (_, id) = radicle::rad::remote(&repo)?;

-
    let output = radicle::git::run::<_, _, &str, &str>(&cwd, &["push", "rad"], None)?;
+
    let output = radicle::git::run::<_, _, &str, &str>(&cwd, ["push", "rad"], None)?;
    println!("{}", output);

    let signer = profile.signer()?;
modified radicle/src/lib.rs
@@ -1,4 +1,5 @@
#![allow(clippy::match_like_matches_macro)]
+
#![allow(clippy::explicit_auto_deref)] // TODO: This can be removed when the clippy bugs are fixed
#![cfg_attr(not(test), warn(clippy::unwrap_used))]

pub extern crate radicle_crypto as crypto;
modified radicle/src/storage/git.rs
@@ -352,9 +352,7 @@ impl Repository {
                let r = reference?;
                let name = r.name().ok_or(refs::Error::InvalidRef)?;
                let (namespace, refname) = git::parse_ref_namespaced::<RemoteId>(name)?;
-
                let oid = if let Some(oid) = r.target() {
-
                    oid
-
                } else {
+
                let Some(oid) = r.target() else {
                    // Ignore symbolic refs, eg. `HEAD`.
                    return Ok(None);
                };
modified rust-toolchain
@@ -1 +1 @@
-
1.64
+
1.65