Skip to content
This repository has been archived by the owner on Sep 4, 2024. It is now read-only.

Clear clippy warnings #74

Merged
merged 2 commits into from
Nov 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -27,7 +28,7 @@ jobs:
- name: Running tests on ${{ matrix.toolchain }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can do this to avoid running on macos:

if: ${{ matrix.os != 'macOS-latest' }}

Also, I've seen it spelled macos-latest before, but maybe that doesn't matter.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do I prevent specifically rustc 1.41 from running on macos?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, sorry, I didn't realize that the combination of macos and 1.41. I didn't test this, but it should be something like:

if: ${{ !(matrix.os == 'macOS-latest' && matrix.toolchain == `1.4.1`) }}

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a huge PITA to test github actions :) bash is easier.

env:
DO_FEATURE_MATRIX: true
run: cargo test --verbose --all-features
run: ./contrib/test.sh

Nightly:
name: Nightly - Docs + Fmt
Expand Down
9 changes: 9 additions & 0 deletions contrib/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions src/simple_http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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));
Expand All @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions src/simple_tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?;

Expand Down Expand Up @@ -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",
Expand Down