Skip to content

Commit 9fa7b61

Browse files
committed
fix: clippy errors on nightly
nightly-x86_64-unknown-linux-gnu (default) rustc 1.86.0-nightly (ae5de6c75 2025-01-29)
1 parent 8bb376d commit 9fa7b61

File tree

12 files changed

+27
-32
lines changed

12 files changed

+27
-32
lines changed

contrib/bencode/src/mutable/bencode_mut.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,7 @@ impl<'a> BRefAccess for BencodeMut<'a> {
8282
fn str(&self) -> Option<&str> {
8383
let bytes = self.bytes()?;
8484

85-
match str::from_utf8(bytes) {
86-
Ok(n) => Some(n),
87-
Err(_) => None,
88-
}
85+
str::from_utf8(bytes).ok()
8986
}
9087

9188
fn int(&self) -> Option<i64> {

contrib/bencode/src/reference/bencode_ref.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,7 @@ impl<'a> BRefAccessExt<'a> for BencodeRef<'a> {
107107
fn str_ext(&self) -> Option<&'a str> {
108108
let bytes = self.bytes_ext()?;
109109

110-
match str::from_utf8(bytes) {
111-
Ok(n) => Some(n),
112-
Err(_) => None,
113-
}
110+
str::from_utf8(bytes).ok()
114111
}
115112

116113
fn bytes_ext(&self) -> Option<&'a [u8]> {

contrib/bencode/src/reference/decode.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ fn decode_dict(
129129
})
130130
}
131131
_ => (),
132-
};
132+
}
133+
133134
curr_pos = next_pos;
134135

135136
let (value, next_pos) = decode(bytes, curr_pos, opts, depth + 1)?;

packages/test-helpers/src/configuration.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ pub fn ephemeral_ipv6() -> Configuration {
153153

154154
if let Some(ref mut http_api) = cfg.http_api {
155155
http_api.bind_address.clone_from(&ipv6);
156-
};
156+
}
157157

158158
if let Some(ref mut http_trackers) = cfg.http_trackers {
159159
http_trackers[0].bind_address.clone_from(&ipv6);

packages/torrent-repository/tests/common/repo.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ impl Repo {
232232
Repo::DashMapMutexStd(repo) => {
233233
repo.torrents.insert(*info_hash, torrent.into());
234234
}
235-
};
235+
}
236236
self.get(info_hash).await
237237
}
238238
}

packages/tracker-api-client/src/v1/client.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ impl Client {
6767

6868
if let Some(token) = &self.connection_info.api_token {
6969
query.add_param(QueryParam::new("token", token));
70-
};
70+
}
7171

7272
self.get_request_with_query(path, query, headers).await
7373
}

packages/tracker-client/src/udp/client.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ pub async fn check(remote_addr: &SocketAddr) -> Result<String, String> {
243243
match client.send(connect_request.into()).await {
244244
Ok(_) => (),
245245
Err(e) => tracing::debug!("Error: {e:?}."),
246-
};
246+
}
247247

248248
let process = move |response| {
249249
if matches!(response, Response::Connect(_connect_response)) {

src/app.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ pub async fn start(config: &Configuration, app_container: &Arc<AppContainer>) ->
9898
http_tracker::start_job(http_tracker_container, registar.give_form(), servers::http::Version::V1).await
9999
{
100100
jobs.push(job);
101-
};
101+
}
102102
}
103103
} else {
104104
tracing::info!("No HTTP blocks in configuration");
@@ -111,7 +111,7 @@ pub async fn start(config: &Configuration, app_container: &Arc<AppContainer>) ->
111111

112112
if let Some(job) = tracker_apis::start_job(http_api_container, registar.give_form(), servers::apis::Version::V1).await {
113113
jobs.push(job);
114-
};
114+
}
115115
} else {
116116
tracing::info!("No API block in configuration");
117117
}

src/console/ci/e2e/logs_parser.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ impl RunningServices {
7676

7777
if !line.contains(INFO_THRESHOLD) {
7878
continue;
79-
};
79+
}
8080

8181
if line.contains(UDP_TRACKER_LOG_TARGET) {
8282
if let Some(captures) = udp_re.captures(&clean_line) {

src/servers/apis/v1/context/auth_key/handlers.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ use crate::servers::apis::v1::responses::{invalid_auth_key_param_response, ok_re
2222
/// It returns these types of responses:
2323
///
2424
/// - `200` with a json [`AuthKey`]
25-
/// resource. If the key was generated successfully.
25+
/// resource. If the key was generated successfully.
2626
/// - `400` with an error if the key couldn't been added because of an invalid
27-
/// request.
27+
/// request.
2828
/// - `500` with serialized error in debug format. If the key couldn't be
29-
/// generated.
29+
/// generated.
3030
///
3131
/// Refer to the [API endpoint documentation](crate::servers::apis::v1::context::auth_key#generate-a-new-authentication-key)
3232
/// for more information about this endpoint.
@@ -57,9 +57,9 @@ pub async fn add_auth_key_handler(
5757
/// It returns two types of responses:
5858
///
5959
/// - `200` with an json [`AuthKey`]
60-
/// resource. If the key was generated successfully.
60+
/// resource. If the key was generated successfully.
6161
/// - `500` with serialized error in debug format. If the key couldn't be
62-
/// generated.
62+
/// generated.
6363
///
6464
/// Refer to the [API endpoint documentation](crate::servers::apis::v1::context::auth_key#generate-a-new-authentication-key)
6565
/// for more information about this endpoint.
@@ -99,9 +99,9 @@ pub struct KeyParam(String);
9999
/// It returns two types of responses:
100100
///
101101
/// - `200` with an json [`ActionStatus::Ok`](crate::servers::apis::v1::responses::ActionStatus::Ok)
102-
/// response. If the key was deleted successfully.
102+
/// response. If the key was deleted successfully.
103103
/// - `500` with serialized error in debug format. If the key couldn't be
104-
/// deleted.
104+
/// deleted.
105105
///
106106
/// Refer to the [API endpoint documentation](crate::servers::apis::v1::context::auth_key#delete-an-authentication-key)
107107
/// for more information about this endpoint.
@@ -124,9 +124,9 @@ pub async fn delete_auth_key_handler(
124124
/// It returns two types of responses:
125125
///
126126
/// - `200` with an json [`ActionStatus::Ok`](crate::servers::apis::v1::responses::ActionStatus::Ok)
127-
/// response. If the keys were successfully reloaded.
127+
/// response. If the keys were successfully reloaded.
128128
/// - `500` with serialized error in debug format. If the they couldn't be
129-
/// reloaded.
129+
/// reloaded.
130130
///
131131
/// Refer to the [API endpoint documentation](crate::servers::apis::v1::context::auth_key#reload-authentication-keys)
132132
/// for more information about this endpoint.

src/servers/udp/server/launcher.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ impl Launcher {
213213
stats_event_sender
214214
.send_event(statistics::event::Event::UdpRequestAborted)
215215
.await;
216-
};
216+
}
217217
}
218218
} else {
219219
tokio::task::yield_now().await;

tests/servers/udp/contract.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ async fn send_connection_request(transaction_id: TransactionId, client: &UdpTrac
2525
match client.send(connect_request.into()).await {
2626
Ok(_) => (),
2727
Err(err) => panic!("{err}"),
28-
};
28+
}
2929

3030
let response = match client.receive().await {
3131
Ok(response) => response,
@@ -52,7 +52,7 @@ async fn should_return_a_bad_request_response_when_the_client_sends_an_empty_req
5252
match client.client.send(&empty_udp_request()).await {
5353
Ok(_) => (),
5454
Err(err) => panic!("{err}"),
55-
};
55+
}
5656

5757
let response = match client.client.receive().await {
5858
Ok(response) => response,
@@ -94,7 +94,7 @@ mod receiving_a_connection_request {
9494
match client.send(connect_request.into()).await {
9595
Ok(_) => (),
9696
Err(err) => panic!("{err}"),
97-
};
97+
}
9898

9999
let response = match client.receive().await {
100100
Ok(response) => response,
@@ -146,7 +146,7 @@ mod receiving_an_announce_request {
146146
match client.send(announce_request.into()).await {
147147
Ok(_) => (),
148148
Err(err) => panic!("{err}"),
149-
};
149+
}
150150

151151
match client.receive().await {
152152
Ok(response) => response,
@@ -276,7 +276,7 @@ mod receiving_an_announce_request {
276276
match client.send(announce_request.into()).await {
277277
Ok(_) => (),
278278
Err(err) => panic!("{err}"),
279-
};
279+
}
280280

281281
assert!(client.receive().await.is_err());
282282

@@ -333,7 +333,7 @@ mod receiving_an_scrape_request {
333333
match client.send(scrape_request.into()).await {
334334
Ok(_) => (),
335335
Err(err) => panic!("{err}"),
336-
};
336+
}
337337

338338
let response = match client.receive().await {
339339
Ok(response) => response,

0 commit comments

Comments
 (0)