Skip to content

Commit

Permalink
chore(ci): add fmt and clippy checks
Browse files Browse the repository at this point in the history
  • Loading branch information
notmandatory committed Aug 1, 2024
1 parent 6d911da commit c6f8b5b
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 17 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/cont_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,35 @@ jobs:
- run: cargo check --verbose --no-default-features --features=proxy,use-openssl
- run: cargo check --verbose --no-default-features --features=proxy,use-rustls
- run: cargo check --verbose --no-default-features --features=proxy,use-rustls-ring

fmt:
name: Rust fmt
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
components: rustfmt
- name: Check fmt
run: cargo fmt --all -- --config format_code_in_doc_comments=true --check

clippy_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.78.0
components: clippy
override: true
- name: Rust Cache
uses: Swatinem/[email protected]
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features --all-targets -- -D warnings
5 changes: 1 addition & 4 deletions src/socks/v4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,7 @@ impl Socks4Stream {
socket.write_all(&packet)?;
let proxy_addr = read_response(&mut socket)?;

Ok(Socks4Stream {
socket,
proxy_addr,
})
Ok(Socks4Stream { socket, proxy_addr })
}

/// Returns the proxy-side address of the connection between the proxy and
Expand Down
16 changes: 3 additions & 13 deletions src/socks/v5.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,7 @@ impl Socks5Stream {

let proxy_addr = read_response(&mut socket)?;

Ok(Socks5Stream {
socket,
proxy_addr,
})
Ok(Socks5Stream { socket, proxy_addr })
}

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

Ok(Socks5Datagram {
socket,
stream,
})
Ok(Socks5Datagram { socket, stream })
}

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

unsafe {
ptr::copy(
buf.as_ptr(),
buf.as_mut_ptr().add(header.len()),
overflow,
);
ptr::copy(buf.as_ptr(), buf.as_mut_ptr().add(header.len()), overflow);
}
buf[..header.len()].copy_from_slice(header);

Expand Down

0 comments on commit c6f8b5b

Please sign in to comment.