Switch to reqwest #991
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 313 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:202:9
|
202 | / Ok(loop {
203 | | futures::select! {
204 | | _ = ka_interval.tick().fuse() => {
205 | | use prost::Message;
... |
312 | | }
313 | | })
| |__________^
|
= 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 `()`
|
202 ~ loop {
203 + futures::select! {
204 + _ = ka_interval.tick().fuse() => {
205 + use prost::Message;
206 + tracing::debug!("sending keep-alive");
207 + let request = WebSocketRequestMessage {
208 + id: Some(self.next_request_id()),
209 + path: Some(self.keep_alive_path.clone()),
210 + verb: Some("GET".into()),
211 + ..Default::default()
212 + };
213 + self.outgoing_keep_alive_set.insert(request.id.unwrap());
214 + let msg = WebSocketMessage {
215 + r#type: Some(web_socket_message::Type::Request.into()),
216 + request: Some(request),
217 + ..Default::default()
218 + };
219 + let buffer = msg.encode_to_vec();
220 + if let Err(e) = self.ws.send(reqwest_websocket::Message::Binary(buffer)).await {
221 + tracing::info!("Websocket sink has closed: {:?}.", e);
222 + break;
223 + };
224 + },
225 + // Process requests from the application, forward them to Signal
226 + x = self.requests.next() => {
227 + match x {
228 + Some((mut request, responder)) => {
229 + use prost::Message;
230 +
231 + // Regenerate ID if already in the table
232 + request.id = Some(
233 + request
234 + .id
235 + .filter(|x| !self.outgoing_request_map.contains_key(x))
236 + .unwrap_or_else(|| self.next_request_id()),
237 + );
238 + tracing::trace!(
239 + "sending WebSocketRequestMessage {{ verb: {:?}, path: {:?}, body (bytes): {:?}, headers: {:?}, id: {:?} }}",
240 + request.verb,
241 + request.path,
242 + request.body.as_ref().map(|x| x.len()),
243 + request.headers,
244 + request.id,
245 + );
246 +
247 + self.outgoing_request_map.insert(request.id.unwrap(), responder);
248 + let msg = WebSocketMessage {
249 + r#type: Some(web_socket_message::Type::Request.into()),
250 + request: Some(request),
251 + ..Default::default()
252 + };
253 + let buffer = msg.encode_to_vec();
254 + self.ws.send(reqwest_websocket::Message::Binary(buffer)).await?
255 + }
256 + None => {
257 + return Err(ServiceError::WsClosing {
258 + reason: "SignalWebSocket: end of application request stream; socket closing"
259 + });
260 + }
261 + }
262 + }
263 + web_socket_item = self.ws.next().fuse() => {
264 + use reqwest_websocket::Message;
265 + match web_socket_item {
266 + Some(Ok(Message::Close { code, reason })) => {
267 + tracing::warn!(%code, reason, "websocket closed");
268 + break;
269 + },
270 + Some(Ok(Message::Binary(frame))) => {
271 + self.process_frame(frame).await?;
272 + }
273 + Some(Ok(Message::Ping(_))) => {
274 + tracing::trace!("received ping");
275 + }
276 + Some(Ok(Message::Pong(_))) => {
277 + tracing::trace!("received pong");
278 + }
279 + Some(Ok(Message::Text(_))) => {
280 + tracing::trace!("received text (unsupported, skipping)");
281 + }
282 + Some(Err(e)) => return Err(ServiceError::WsError(e)),
283 + None => {
284 + return Err(ServiceError::WsClosing {
285 + reason: "end of web request stream; socket closing"
286 + });
287 + }
288 + }
289 + }
290 + response = self.outgoing_responses.next() => {
291 + use prost::Message;
292 + match response {
293 + Some(Ok(response)) => {
294 + tracing::trace!("sending response {:?}", response);
295 +
296 + let msg = WebSocketMessage {
297 + r#type: Some(web_socket_message::Type::Response.into()),
298 + response: Some(response),
299 + ..Default::default()
300 + };
301 + let buffer = msg.encode_to_vec();
302 + self.ws.send(buffer.into()).await?;
303 + }
304 + Some(Err(e)) => {
305 + tracing::error!("could not generate response to a Signal request; responder was canceled: {}. Continuing.", e);
306 + }
307 + None => {
308 + unreachable!("outgoing responses should never fuse")
309 + }
310 + }
311 + }
312 + }
313 + };
314 + Ok(())
|
Check warning on line 132 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:132:33
|
132 | 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 161 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:161:21
|
161 | &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 311 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:311:13
|
311 | &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 287 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:287:13
|
287 | &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 240 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:240:13
|
240 | &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 54 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:54:13
|
54 | &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 256 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:256:17
|
256 | &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