Skip to content

Commit 5dc4bb6

Browse files
committed
ci: bump clippy to 1.90.0
- Fixed hidden lifetime in `Batch::iter` - Use `io::Error::other` in place of `io::Error::new` when the error kind is `ErrorKind::Other`.
1 parent e31cf47 commit 5dc4bb6

File tree

4 files changed

+17
-51
lines changed

4 files changed

+17
-51
lines changed

.github/workflows/cont_integration.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,10 @@ jobs:
6262
runs-on: ubuntu-latest
6363
steps:
6464
- uses: actions/checkout@v4
65-
- uses: dtolnay/rust-toolchain@stable
65+
- uses: dtolnay/rust-toolchain@v1
6666
with:
67-
toolchain: 1.84.0
67+
toolchain: 1.90.0
6868
components: clippy
6969
- name: Rust Cache
7070
uses: Swatinem/[email protected]
71-
- uses: actions-rs/clippy-check@v1
72-
with:
73-
token: ${{ secrets.GITHUB_TOKEN }}
74-
args: --all-features --all-targets -- -D warnings
71+
- run: cargo clippy --all-features --all-targets -- -D warnings

src/batch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ impl Batch {
8888
}
8989

9090
/// Returns an iterator on the batch
91-
pub fn iter(&self) -> BatchIter {
91+
pub fn iter(&self) -> BatchIter<'_> {
9292
BatchIter {
9393
batch: self,
9494
index: 0,

src/socks/v4.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,7 @@ fn read_response(socket: &mut TcpStream) -> io::Result<SocketAddrV4> {
1818

1919
match response.read_u8()? {
2020
90 => {}
21-
91 => {
22-
return Err(io::Error::new(
23-
io::ErrorKind::Other,
24-
"request rejected or failed",
25-
))
26-
}
21+
91 => return Err(io::Error::other("request rejected or failed")),
2722
92 => {
2823
return Err(io::Error::new(
2924
io::ErrorKind::PermissionDenied,

src/socks/v5.rs

Lines changed: 12 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,7 @@ fn read_addr<R: Read>(socket: &mut R) -> io::Result<TargetAddr> {
3737
ip, port, 0, 0,
3838
))))
3939
}
40-
_ => Err(io::Error::new(
41-
io::ErrorKind::Other,
42-
"unsupported address type",
43-
)),
40+
_ => Err(io::Error::other("unsupported address type")),
4441
}
4542
}
4643

@@ -54,35 +51,15 @@ fn read_response(socket: &mut TcpStream) -> io::Result<TargetAddr> {
5451

5552
match socket.read_u8()? {
5653
0 => {}
57-
1 => {
58-
return Err(io::Error::new(
59-
io::ErrorKind::Other,
60-
"general SOCKS server failure",
61-
))
62-
}
63-
2 => {
64-
return Err(io::Error::new(
65-
io::ErrorKind::Other,
66-
"connection not allowed by ruleset",
67-
))
68-
}
69-
3 => return Err(io::Error::new(io::ErrorKind::Other, "network unreachable")),
70-
4 => return Err(io::Error::new(io::ErrorKind::Other, "host unreachable")),
71-
5 => return Err(io::Error::new(io::ErrorKind::Other, "connection refused")),
72-
6 => return Err(io::Error::new(io::ErrorKind::Other, "TTL expired")),
73-
7 => {
74-
return Err(io::Error::new(
75-
io::ErrorKind::Other,
76-
"command not supported",
77-
))
78-
}
79-
8 => {
80-
return Err(io::Error::new(
81-
io::ErrorKind::Other,
82-
"address kind not supported",
83-
))
84-
}
85-
_ => return Err(io::Error::new(io::ErrorKind::Other, "unknown error")),
54+
1 => return Err(io::Error::other("general SOCKS server failure")),
55+
2 => return Err(io::Error::other("connection not allowed by ruleset")),
56+
3 => return Err(io::Error::other("network unreachable")),
57+
4 => return Err(io::Error::other("host unreachable")),
58+
5 => return Err(io::Error::other("connection refused")),
59+
6 => return Err(io::Error::other("TTL expired")),
60+
7 => return Err(io::Error::other("command not supported")),
61+
8 => return Err(io::Error::other("address kind not supported")),
62+
_ => return Err(io::Error::other("unknown error")),
8663
}
8764

8865
if socket.read_u8()? != 0 {
@@ -227,14 +204,11 @@ impl Socks5Stream {
227204
}
228205

229206
if selected_method == 0xff {
230-
return Err(io::Error::new(
231-
io::ErrorKind::Other,
232-
"no acceptable auth methods",
233-
));
207+
return Err(io::Error::other("no acceptable auth methods"));
234208
}
235209

236210
if selected_method != auth.id() && selected_method != Authentication::None.id() {
237-
return Err(io::Error::new(io::ErrorKind::Other, "unknown auth method"));
211+
return Err(io::Error::other("unknown auth method"));
238212
}
239213

240214
match *auth {

0 commit comments

Comments
 (0)