Skip to content

Commit 966a1c6

Browse files
committed
chore(ci): add fmt and clippy checks
1 parent 6d911da commit 966a1c6

File tree

4 files changed

+36
-18
lines changed

4 files changed

+36
-18
lines changed

.github/workflows/cont_integration.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,35 @@ jobs:
4646
- run: cargo check --verbose --no-default-features --features=proxy,use-openssl
4747
- run: cargo check --verbose --no-default-features --features=proxy,use-rustls
4848
- run: cargo check --verbose --no-default-features --features=proxy,use-rustls-ring
49+
50+
fmt:
51+
name: Rust fmt
52+
runs-on: ubuntu-latest
53+
steps:
54+
- name: Checkout
55+
uses: actions/checkout@v2
56+
- name: Install Rust toolchain
57+
uses: actions-rs/toolchain@v1
58+
with:
59+
toolchain: stable
60+
override: true
61+
profile: minimal
62+
components: rustfmt
63+
- name: Check fmt
64+
run: cargo fmt --all -- --config format_code_in_doc_comments=true --check
65+
66+
clippy_check:
67+
runs-on: ubuntu-latest
68+
steps:
69+
- uses: actions/checkout@v1
70+
- uses: actions-rs/toolchain@v1
71+
with:
72+
toolchain: 1.78.0
73+
components: clippy
74+
override: true
75+
- name: Rust Cache
76+
uses: Swatinem/rust-cache@v2.2.1
77+
- uses: actions-rs/clippy-check@v1
78+
with:
79+
token: ${{ secrets.GITHUB_TOKEN }}
80+
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)