Skip to content

Commit 700bbbe

Browse files
committed
Fix clippy lints, update CI to check all features
1 parent 258efe1 commit 700bbbe

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

.github/workflows/rust.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
run: ./scripts/check.sh
4242

4343
- name: Check with Clippy
44-
run: cargo clippy --all-targets -- -A clippy::redundant_field_names
44+
run: cargo clippy --all-targets --all-features -- -A clippy::redundant_field_names
4545

4646
- name: Build
4747
run: cargo build --release

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: clippy
1717
env: CACHE_BUCKET=clippy
1818
install: rustup component add clippy
19-
script: cargo clippy --all-targets -- -A clippy::redundant_field_names
19+
script: cargo clippy --all-targets --all-features -- -A clippy::redundant_field_names
2020
- name: e2e tests
2121
env: CACHE_BUCKET=test
2222
install: source scripts/ci-test-deps.sh

src/http.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ fn setup(
434434
// GET /bitcoin.pdf
435435
let whitepaper_handler = warp::get()
436436
.and(warp::path!("bitcoin.pdf"))
437-
.and(query.clone())
437+
.and(query)
438438
.map(|query: Arc<Query>| {
439439
let pdf_blob = whitepaper::get_whitepaper_pdf(query.rpc())?;
440440
Ok(reply::with_header(

src/util/auth.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -104,18 +104,18 @@ pub fn electrum_socks5_auth(
104104
let mut authenticated = false;
105105

106106
if auth_methods.contains(&AUTH_USERPWD) {
107-
stream.write(&[SOCKS5, AUTH_USERPWD])?;
107+
stream.write_all(&[SOCKS5, AUTH_USERPWD])?;
108108

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

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

src/util/descriptor.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ impl DescriptorExt for ExtendedDescriptor {
109109

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

0 commit comments

Comments
 (0)