Skip to content

Commit 0dd5140

Browse files
committed
chore(ci): add fmt and clippy checks
1 parent e7af332 commit 0dd5140

File tree

4 files changed

+39
-29
lines changed

4 files changed

+39
-29
lines changed

.github/workflows/cont_integration.yml

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,19 @@ on: [push, pull_request]
33
name: CI
44

55
jobs:
6-
test-fmt:
6+
test:
77
name: Test
88
runs-on: ubuntu-20.04
99
env:
1010
TEST_ELECTRUM_SERVER: electrum.blockstream.info:50001
11-
#TEST_ELECTRUM_SERVER: bitcoin.aranguren.org:50001
1211
strategy:
1312
matrix:
1413
rust:
1514
- stable # STABLE
1615
- 1.63.0 # MSRV
1716
steps:
1817
- name: Checkout
19-
uses: actions/checkout@v2
18+
uses: actions/checkout@v4
2019
- name: Cache
2120
uses: actions/cache@v2
2221
with:
@@ -25,14 +24,10 @@ jobs:
2524
~/.cargo/git
2625
target
2726
key: ${{ runner.os }}-cargo-${{ github.job }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
28-
- name: Install rustup
29-
run: curl https://sh.rustup.rs -sSf | sh -s -- -y
30-
- name: Set default toolchain
31-
run: $HOME/.cargo/bin/rustup default ${{ matrix.rust }}
32-
- name: Set profile
33-
run: $HOME/.cargo/bin/rustup set profile minimal
34-
- name: Fmt
35-
run: cargo fmt -- --check --verbose
27+
- name: Install rust
28+
uses: dtolnay/rust-toolchain@stable
29+
with:
30+
toolchain: ${{ matrix.rust }}
3631
- name: Test
3732
run: cargo test --verbose --all-features
3833
- name: Setup iptables for the timeout test
@@ -46,3 +41,32 @@ jobs:
4641
- run: cargo check --verbose --no-default-features --features=proxy,use-openssl
4742
- run: cargo check --verbose --no-default-features --features=proxy,use-rustls
4843
- run: cargo check --verbose --no-default-features --features=proxy,use-rustls-ring
44+
45+
fmt:
46+
name: Rust fmt
47+
runs-on: ubuntu-latest
48+
steps:
49+
- name: Checkout
50+
uses: actions/checkout@v4
51+
- name: Install Rust toolchain
52+
uses: dtolnay/rust-toolchain@stable
53+
with:
54+
toolchain: stable
55+
components: rustfmt
56+
- name: Check fmt
57+
run: cargo fmt --all -- --config format_code_in_doc_comments=true --check
58+
59+
clippy_check:
60+
runs-on: ubuntu-latest
61+
steps:
62+
- uses: actions/checkout@v4
63+
- uses: dtolnay/rust-toolchain@stable
64+
with:
65+
toolchain: 1.78.0
66+
components: clippy
67+
- name: Rust Cache
68+
uses: Swatinem/rust-cache@v2.2.1
69+
- uses: actions-rs/clippy-check@v1
70+
with:
71+
token: ${{ secrets.GITHUB_TOKEN }}
72+
args: --all-features --all-targets -- -D warnings

src/client.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ impl Client {
148148
/// If no prefix is specified, then `tcp://` is assumed.
149149
///
150150
/// See [Client::from_config] for more configuration options
151-
///
152151
pub fn new(url: &str) -> Result<Self, Error> {
153152
Self::from_config(url, Config::default())
154153
}

src/socks/v4.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,7 @@ impl Socks4Stream {
117117
socket.write_all(&packet)?;
118118
let proxy_addr = read_response(&mut socket)?;
119119

120-
Ok(Socks4Stream {
121-
socket,
122-
proxy_addr,
123-
})
120+
Ok(Socks4Stream { socket, proxy_addr })
124121
}
125122

126123
/// Returns the proxy-side address of the connection between the proxy and

src/socks/v5.rs

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,7 @@ impl Socks5Stream {
253253

254254
let proxy_addr = read_response(&mut socket)?;
255255

256-
Ok(Socks5Stream {
257-
socket,
258-
proxy_addr,
259-
})
256+
Ok(Socks5Stream { socket, proxy_addr })
260257
}
261258

262259
fn password_authentication(
@@ -470,10 +467,7 @@ impl Socks5Datagram {
470467
let socket = UdpSocket::bind(addr)?;
471468
socket.connect(&stream.proxy_addr)?;
472469

473-
Ok(Socks5Datagram {
474-
socket,
475-
stream,
476-
})
470+
Ok(Socks5Datagram { socket, stream })
477471
}
478472

479473
/// Like `UdpSocket::send_to`.
@@ -522,11 +516,7 @@ impl Socks5Datagram {
522516
let addr = read_addr(&mut header)?;
523517

524518
unsafe {
525-
ptr::copy(
526-
buf.as_ptr(),
527-
buf.as_mut_ptr().add(header.len()),
528-
overflow,
529-
);
519+
ptr::copy(buf.as_ptr(), buf.as_mut_ptr().add(header.len()), overflow);
530520
}
531521
buf[..header.len()].copy_from_slice(header);
532522

0 commit comments

Comments
 (0)