diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index c54f0106..c062361d 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -6,14 +6,15 @@ jobs: Tests: name: Tests strategy: + fail-fast: false matrix: os: - ubuntu-latest - macOS-latest - windows-latest toolchain: - - 1.41.1 - stable + - 1.41.1 runs-on: ${{ matrix.os }} steps: - name: Checkout Crate @@ -27,7 +28,7 @@ jobs: - name: Running tests on ${{ matrix.toolchain }} env: DO_FEATURE_MATRIX: true - run: cargo test --verbose --all-features + run: ./contrib/test.sh Nightly: name: Nightly - Docs + Fmt diff --git a/contrib/test.sh b/contrib/test.sh index 3dca52e2..bf7e8a9f 100755 --- a/contrib/test.sh +++ b/contrib/test.sh @@ -11,6 +11,15 @@ if cargo --version | grep nightly; then NIGHTLY=true fi +# On MacOS on 1.41 we get a link failure with syn +# This is fixed by https://github.com/rust-lang/rust/pull/91604 (I think) +# but implies that we can't do testing on MacOS for now, at least with 1.41. +if cargo --version | grep "1\.41\.0"; then + if [ "$RUNNER_OS" = "macOS" ]; then + exit 0 + fi +fi + # Defaults / sanity checks cargo build --all cargo test --all diff --git a/src/client.rs b/src/client.rs index 3b2c3506..d0b6f3be 100644 --- a/src/client.rs +++ b/src/client.rs @@ -132,7 +132,7 @@ impl Client { let id = request.id.clone(); let response = self.send_request(request)?; - if response.jsonrpc != None && response.jsonrpc != Some(From::from("2.0")) { + if response.jsonrpc.is_some() && response.jsonrpc != Some(From::from("2.0")) { return Err(Error::VersionMismatch); } if response.id != id { diff --git a/src/simple_http.rs b/src/simple_http.rs index c81c43d3..09c85cff 100644 --- a/src/simple_http.rs +++ b/src/simple_http.rs @@ -479,7 +479,7 @@ mod tests { "http://me:weak@localhost:22/wallet", ]; for u in &urls { - let tp = Builder::new().url(*u).unwrap().build(); + let tp = Builder::new().url(u).unwrap().build(); assert_eq!(tp.addr, addr); } @@ -506,7 +506,7 @@ mod tests { ]; for u in &valid_urls { let (addr, path) = check_url(u).unwrap(); - let builder = Builder::new().url(*u).unwrap_or_else(|_| panic!("error for: {}", u)); + let builder = Builder::new().url(u).unwrap_or_else(|_| panic!("error for: {}", u)); assert_eq!(builder.tp.addr, addr); assert_eq!(builder.tp.path, path); assert_eq!(builder.tp.timeout, Duration::from_secs(15)); @@ -523,7 +523,7 @@ mod tests { // NB somehow, Rust's IpAddr accepts "127.0.0" and adds the extra 0.. ]; for u in &invalid_urls { - if let Ok(b) = Builder::new().url(*u) { + if let Ok(b) = Builder::new().url(u) { let tp = b.build(); panic!("expected error for url {}, got {:?}", u, tp); } diff --git a/src/simple_tcp.rs b/src/simple_tcp.rs index accc27ca..86367213 100644 --- a/src/simple_tcp.rs +++ b/src/simple_tcp.rs @@ -85,7 +85,7 @@ impl TcpTransport { where R: for<'a> serde::de::Deserialize<'a>, { - let mut sock = net::TcpStream::connect(&self.addr)?; + let mut sock = net::TcpStream::connect(self.addr)?; sock.set_read_timeout(self.timeout)?; sock.set_write_timeout(self.timeout)?; @@ -129,7 +129,7 @@ mod tests { fn sanity_check_tcp_transport() { let addr: net::SocketAddr = net::SocketAddrV4::new(net::Ipv4Addr::new(127, 0, 0, 1), 0).into(); - let server = net::TcpListener::bind(&addr).unwrap(); + let server = net::TcpListener::bind(addr).unwrap(); let addr = server.local_addr().unwrap(); let dummy_req = Request { method: "arandommethod",