Switch to reqwest #993
clippy
10 warnings
Details
Results
Message level | Amount |
---|---|
Internal compiler error | 0 |
Error | 0 |
Warning | 10 |
Note | 0 |
Help | 0 |
Versions
- rustc 1.81.0 (eeb90cda1 2024-09-04)
- cargo 1.81.0 (2dbb1af80 2024-08-20)
- clippy 0.1.81 (eeb90cd 2024-09-04)
Annotations
Check warning on line 312 in src/websocket/mod.rs
github-actions / clippy
passing a unit value to a function
warning: passing a unit value to a function
--> src/websocket/mod.rs:200:9
|
200 | / Ok(loop {
201 | | futures::select! {
202 | | _ = ka_interval.tick().fuse() => {
203 | | use prost::Message;
... |
311 | | }
312 | | })
| |__________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unit_arg
= note: `#[warn(clippy::unit_arg)]` on by default
help: move the expression in front of the call and replace it with the unit literal `()`
|
200 ~ loop {
201 + futures::select! {
202 + _ = ka_interval.tick().fuse() => {
203 + use prost::Message;
204 + tracing::debug!("sending keep-alive");
205 + let request = WebSocketRequestMessage {
206 + id: Some(self.next_request_id()),
207 + path: Some(self.keep_alive_path.clone()),
208 + verb: Some("GET".into()),
209 + ..Default::default()
210 + };
211 + self.outgoing_keep_alive_set.insert(request.id.unwrap());
212 + let msg = WebSocketMessage {
213 + r#type: Some(web_socket_message::Type::Request.into()),
214 + request: Some(request),
215 + ..Default::default()
216 + };
217 + let buffer = msg.encode_to_vec();
218 + if let Err(e) = self.ws.send(reqwest_websocket::Message::Binary(buffer)).await {
219 + tracing::info!("Websocket sink has closed: {:?}.", e);
220 + break;
221 + };
222 + },
223 + // Process requests from the application, forward them to Signal
224 + x = self.requests.next() => {
225 + match x {
226 + Some((mut request, responder)) => {
227 + use prost::Message;
228 +
229 + // Regenerate ID if already in the table
230 + request.id = Some(
231 + request
232 + .id
233 + .filter(|x| !self.outgoing_requests.contains_key(x))
234 + .unwrap_or_else(|| self.next_request_id()),
235 + );
236 + tracing::trace!(
237 + request.id,
238 + request.verb,
239 + request.path,
240 + request_body_size_bytes = request.body.as_ref().map(|x| x.len()),
241 + ?request.headers,
242 + "sending WebSocketRequestMessage",
243 + );
244 +
245 + self.outgoing_requests.insert(request.id.unwrap(), responder);
246 + let msg = WebSocketMessage {
247 + r#type: Some(web_socket_message::Type::Request.into()),
248 + request: Some(request),
249 + ..Default::default()
250 + };
251 + let buffer = msg.encode_to_vec();
252 + self.ws.send(reqwest_websocket::Message::Binary(buffer)).await?
253 + }
254 + None => {
255 + return Err(ServiceError::WsClosing {
256 + reason: "end of application request stream; socket closing"
257 + });
258 + }
259 + }
260 + }
261 + // Incoming websocket message
262 + web_socket_item = self.ws.next().fuse() => {
263 + use reqwest_websocket::Message;
264 + match web_socket_item {
265 + Some(Ok(Message::Close { code, reason })) => {
266 + tracing::warn!(%code, reason, "websocket closed");
267 + break;
268 + },
269 + Some(Ok(Message::Binary(frame))) => {
270 + self.process_frame(frame).await?;
271 + }
272 + Some(Ok(Message::Ping(_))) => {
273 + tracing::trace!("received ping");
274 + }
275 + Some(Ok(Message::Pong(_))) => {
276 + tracing::trace!("received pong");
277 + }
278 + Some(Ok(Message::Text(_))) => {
279 + tracing::trace!("received text (unsupported, skipping)");
280 + }
281 + Some(Err(e)) => return Err(ServiceError::WsError(e)),
282 + None => {
283 + return Err(ServiceError::WsClosing {
284 + reason: "end of web request stream; socket closing"
285 + });
286 + }
287 + }
288 + }
289 + response = self.outgoing_responses.next() => {
290 + use prost::Message;
291 + match response {
292 + Some(Ok(response)) => {
293 + tracing::trace!("sending response {:?}", response);
294 +
295 + let msg = WebSocketMessage {
296 + r#type: Some(web_socket_message::Type::Response.into()),
297 + response: Some(response),
298 + ..Default::default()
299 + };
300 + let buffer = msg.encode_to_vec();
301 + self.ws.send(buffer.into()).await?;
302 + }
303 + Some(Err(error)) => {
304 + tracing::error!(%error, "could not generate response to a Signal request; responder was canceled. continuing.");
305 + }
306 + None => {
307 + unreachable!("outgoing responses should never fuse")
308 + }
309 + }
310 + }
311 + }
312 + };
313 + Ok(())
|
Check warning on line 131 in src/websocket/mod.rs
github-actions / clippy
useless conversion to the same type: `&str`
warning: useless conversion to the same type: `&str`
--> src/websocket/mod.rs:131:33
|
131 | reason: "request handler failed".into(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into()`: `"request handler failed"`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
Check warning on line 163 in src/push_service/mod.rs
github-actions / clippy
this expression creates a reference which is immediately dereferenced by the compiler
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/push_service/mod.rs:163:21
|
163 | &cfg.certificate_authority.as_bytes(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `cfg.certificate_authority.as_bytes()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
= note: `#[warn(clippy::needless_borrow)]` on by default
Check warning on line 319 in src/push_service/registration.rs
github-actions / clippy
the borrowed expression implements the required traits
warning: the borrowed expression implements the required traits
--> src/push_service/registration.rs:319:13
|
319 | &format!("/v1/verification/session/{}/code", session_id),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `format!("/v1/verification/session/{}/code", session_id)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
Check warning on line 293 in src/push_service/registration.rs
github-actions / clippy
the borrowed expression implements the required traits
warning: the borrowed expression implements the required traits
--> src/push_service/registration.rs:293:13
|
293 | &format!("/v1/verification/session/{}/code", session_id),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `format!("/v1/verification/session/{}/code", session_id)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
Check warning on line 244 in src/push_service/registration.rs
github-actions / clippy
the borrowed expression implements the required traits
warning: the borrowed expression implements the required traits
--> src/push_service/registration.rs:244:13
|
244 | &format!("/v1/verification/session/{}", session_id),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `format!("/v1/verification/session/{}", session_id)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
Check warning on line 56 in src/push_service/keys.rs
github-actions / clippy
the borrowed expression implements the required traits
warning: the borrowed expression implements the required traits
--> src/push_service/keys.rs:56:13
|
56 | &format!("/v2/keys?identity={}", service_id_type),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `format!("/v2/keys?identity={}", service_id_type)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
Check warning on line 36 in src/push_service/keys.rs
github-actions / clippy
the borrowed expression implements the required traits
warning: the borrowed expression implements the required traits
--> src/push_service/keys.rs:36:13
|
36 | &format!("/v2/keys?identity={}", service_id_type),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `format!("/v2/keys?identity={}", service_id_type)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
Check warning on line 100 in src/messagepipe.rs
github-actions / clippy
useless conversion to the same type: `&str`
warning: useless conversion to the same type: `&str`
--> src/messagepipe.rs:100:25
|
100 | reason: "could not respond to message pipe request".into(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into()`: `"could not respond to message pipe request"`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
= note: `#[warn(clippy::useless_conversion)]` on by default
Check warning on line 258 in src/account_manager.rs
github-actions / clippy
the borrowed expression implements the required traits
warning: the borrowed expression implements the required traits
--> src/account_manager.rs:258:17
|
258 | &format!("/v1/provisioning/{}", destination),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `format!("/v1/provisioning/{}", destination)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
= note: `#[warn(clippy::needless_borrows_for_generic_args)]` on by default