Skip to content

Commit

Permalink
Fix clippy lints, update CI to check all features
Browse files Browse the repository at this point in the history
  • Loading branch information
shesek committed Jan 28, 2021
1 parent 258efe1 commit 700bbbe
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
run: ./scripts/check.sh

- name: Check with Clippy
run: cargo clippy --all-targets -- -A clippy::redundant_field_names
run: cargo clippy --all-targets --all-features -- -A clippy::redundant_field_names

- name: Build
run: cargo build --release
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: clippy
env: CACHE_BUCKET=clippy
install: rustup component add clippy
script: cargo clippy --all-targets -- -A clippy::redundant_field_names
script: cargo clippy --all-targets --all-features -- -A clippy::redundant_field_names
- name: e2e tests
env: CACHE_BUCKET=test
install: source scripts/ci-test-deps.sh
Expand Down
2 changes: 1 addition & 1 deletion src/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ fn setup(
// GET /bitcoin.pdf
let whitepaper_handler = warp::get()
.and(warp::path!("bitcoin.pdf"))
.and(query.clone())
.and(query)
.map(|query: Arc<Query>| {
let pdf_blob = whitepaper::get_whitepaper_pdf(query.rpc())?;
Ok(reply::with_header(
Expand Down
10 changes: 5 additions & 5 deletions src/util/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,18 +104,18 @@ pub fn electrum_socks5_auth(
let mut authenticated = false;

if auth_methods.contains(&AUTH_USERPWD) {
stream.write(&[SOCKS5, AUTH_USERPWD])?;
stream.write_all(&[SOCKS5, AUTH_USERPWD])?;

// Client authentication: VER=0x01, <USERLEN><USER>, <PWDLEN><PWD>
ensure!(read_byte(&mut reader)? == AUTH_VER, "invalid auth version");
let _username = read_var(&mut reader)?; // the username can be anything
let password = String::from_utf8(read_var(&mut reader)?)?;
ensure!(password == access_token, "invalid token (userpwd)");
authenticated = true;
stream.write(&[AUTH_VER, SUCCESS])?;
stream.write_all(&[AUTH_VER, SUCCESS])?;
} else if auth_methods.contains(&AUTH_NONE) {
// Allow no authentication for now, require hostname-based authentication instead (below)
stream.write(&[SOCKS5, AUTH_NONE])?;
stream.write_all(&[SOCKS5, AUTH_NONE])?;
} else {
bail!("incompatible auth methods");
}
Expand All @@ -124,7 +124,7 @@ pub fn electrum_socks5_auth(
// Where DSTADDR is either {IPv4(0x01), <ADDR>(4 bytes)} or {DOMAIN(0x03), <ADDRLEN><ADDR>}
let mut buf = [0; 4];
reader.read_exact(&mut buf)?;
ensure!(&buf[0..3] == &[SOCKS5, CONNECT, RSV], "invalid connect");
ensure!(buf[0..3] == [SOCKS5, CONNECT, RSV], "invalid connect");
match buf[3] {
// Consume and ignore IPv4 addresses
ADDR_IPV4 => reader.read_exact(&mut [0; 4])?,
Expand All @@ -142,7 +142,7 @@ pub fn electrum_socks5_auth(
reader.read_exact(&mut [0; 2])?;

// Server response: VER, STATUS, RSV, BNDADDR={IPv4(0x01), =0.0.0.0}, BNDPORT=0x0000
stream.write(&[
stream.write_all(&[
SOCKS5, SUCCESS, RSV, ADDR_IPV4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
])?;

Expand Down
2 changes: 1 addition & 1 deletion src/util/descriptor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ impl DescriptorExt for ExtendedDescriptor {

fn checksum(&self) -> Checksum {
let desc_str = self.to_string();
let checksum = desc_str.splitn(2, '#').skip(1).next().unwrap();
let checksum = desc_str.splitn(2, '#').nth(1).unwrap();
Checksum(checksum.into())
}

Expand Down

0 comments on commit 700bbbe

Please sign in to comment.