Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: refactor: migrate to native async trait #1268

Closed
wants to merge 2 commits into from

remove async-trait crate

870234c
Select commit
Loading
Failed to load commit list.
Sign in for the full log view
Closed

WIP: refactor: migrate to native async trait #1268

remove async-trait crate
870234c
Select commit
Loading
Failed to load commit list.
GitHub Actions / clippy succeeded Jan 3, 2024 in 0s

clippy

14 warnings

Details

Results

Message level Amount
Internal compiler error 0
Error 0
Warning 14
Note 0
Help 0

Versions

  • rustc 1.75.0 (82e1608df 2023-12-21)
  • cargo 1.75.0 (1d8b05cdd 2023-11-20)
  • clippy 0.1.75 (82e1608 2023-12-21)

Annotations

Check warning on line 441 in client/http-client/src/client.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this function can be simplified using the `async fn` syntax

warning: this function can be simplified using the `async fn` syntax
   --> client/http-client/src/client.rs:440:2
    |
440 |       #[instrument(name = "subscribe_method", fields(method = _method), skip(self, _method), level = "trace")]
    |       ^-------------------------------------------------------------------------------------------------------
    |       |
    |  _____in this procedural macro expansion
    | |
441 | |     fn subscribe_to_method<'a, N>(&self, _method: &'a str) -> impl Future<Output = Result<Subscription<N>, Error>>
    | |__________________________________________________________________________________________________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_async_fn
    = note: this warning originates in the attribute macro `instrument` (in Nightly builds, run with -Z macro-backtrace for more info)

Check warning on line 431 in client/http-client/src/client.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this function can be simplified using the `async fn` syntax

warning: this function can be simplified using the `async fn` syntax
   --> client/http-client/src/client.rs:425:2
    |
425 |       #[instrument(name = "subscription", fields(method = _subscribe_method), skip(self, _params, _subscribe_method, _unsubscribe_method), level = "trace")]
    |       ^-----------------------------------------------------------------------------------------------------------------------------------------------------
    |       |
    |  _____in this procedural macro expansion
    | |
426 | |     fn subscribe<'a, N, Params>(
427 | |         &self,
428 | |         _subscribe_method: &'a str,
429 | |         _params: Params,
430 | |         _unsubscribe_method: &'a str,
431 | |     ) -> impl Future<Output = Result<Subscription<N>, Error>>
    | |_____________________________________________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_async_fn
    = note: this warning originates in the attribute macro `instrument` (in Nightly builds, run with -Z macro-backtrace for more info)

Check warning on line 344 in client/http-client/src/client.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this function can be simplified using the `async fn` syntax

warning: this function can be simplified using the `async fn` syntax
   --> client/http-client/src/client.rs:340:2
    |
340 |       #[instrument(name = "batch", skip(self, batch), level = "trace")]
    |       ^----------------------------------------------------------------
    |       |
    |  _____in this procedural macro expansion
    | |
341 | |     fn batch_request<'a, R>(
342 | |         &self,
343 | |         batch: BatchRequestBuilder<'a>,
344 | |     ) -> impl Future<Output = Result<BatchResponse<'a, R>, Error>>
    | |__________________________________________________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_async_fn
    = note: this warning originates in the attribute macro `instrument` (in Nightly builds, run with -Z macro-backtrace for more info)

Check warning on line 302 in client/http-client/src/client.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this function can be simplified using the `async fn` syntax

warning: this function can be simplified using the `async fn` syntax
   --> client/http-client/src/client.rs:301:2
    |
301 |       #[instrument(name = "method_call", skip(self, params), level = "trace")]
    |       ^-----------------------------------------------------------------------
    |       |
    |  _____in this procedural macro expansion
    | |
302 | |     fn request<R, Params>(&self, method: &str, params: Params) -> impl Future<Output = Result<R, Error>>
    | |________________________________________________________________________________________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_async_fn
    = note: this warning originates in the attribute macro `instrument` (in Nightly builds, run with -Z macro-backtrace for more info)

Check warning on line 282 in client/http-client/src/client.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this function can be simplified using the `async fn` syntax

warning: this function can be simplified using the `async fn` syntax
   --> client/http-client/src/client.rs:281:2
    |
281 |       #[instrument(name = "notification", skip(self, params), level = "trace")]
    |       ^------------------------------------------------------------------------
    |       |
    |  _____in this procedural macro expansion
    | |
282 | |     fn notification<Params>(&self, method: &str, params: Params) -> impl Future<Output = Result<(), Error>>
    | |___________________________________________________________________________________________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_async_fn
    = note: `#[warn(clippy::manual_async_fn)]` on by default
    = note: this warning originates in the attribute macro `instrument` (in Nightly builds, run with -Z macro-backtrace for more info)

Check warning on line 283 in client/transport/src/ws/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this function can be simplified using the `async fn` syntax

warning: this function can be simplified using the `async fn` syntax
   --> client/transport/src/ws/mod.rs:283:2
    |
283 |     fn receive(&mut self) -> impl Future<Output = Result<ReceivedMessage, Self::Error>> {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_async_fn
help: make the function `async` and return the output of the future directly
    |
283 |     async fn receive(&mut self) -> Result<ReceivedMessage, Self::Error> {
    |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: move the body of the async block to the enclosing function
    |
283 ~     fn receive(&mut self) -> impl Future<Output = Result<ReceivedMessage, Self::Error>> {
284 ~              loop {
285 ~                  let mut message = Vec::new();
286 ~                  let recv = self.inner.receive(&mut message).await?;
287 + 
288 ~                  match recv {
289 ~                      Incoming::Data(Data::Text(_)) => {
290 ~                          let s =
291 ~                              String::from_utf8(message).map_err(|err| WsError::Connection(Utf8(err.utf8_error())))?;
292 ~                          break Ok(ReceivedMessage::Text(s));
293 ~                      }
294 ~                      Incoming::Data(Data::Binary(_)) => break Ok(ReceivedMessage::Bytes(message)),
295 ~                      Incoming::Pong(_) => break Ok(ReceivedMessage::Pong),
296 ~                      _ => continue,
297 ~                  }
298 ~              }
299 ~          }
    |

Check warning on line 271 in client/transport/src/ws/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this function can be simplified using the `async fn` syntax

warning: this function can be simplified using the `async fn` syntax
   --> client/transport/src/ws/mod.rs:271:2
    |
271 |     fn close(&mut self) -> impl Future<Output = Result<(), Self::Error>> + MaybeSend {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_async_fn
help: make the function `async` and return the output of the future directly
    |
271 |     async fn close(&mut self) -> Result<(), Self::Error> {
    |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: move the body of the async block to the enclosing function
    |
271 |     fn close(&mut self) -> impl Future<Output = Result<(), Self::Error>> + MaybeSend { self.inner.close().await.map_err(Into::into) }
    |                                                                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Check warning on line 256 in client/transport/src/ws/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this function can be simplified using the `async fn` syntax

warning: this function can be simplified using the `async fn` syntax
   --> client/transport/src/ws/mod.rs:256:2
    |
256 |     fn send_ping(&mut self) -> impl Future<Output = Result<(), Self::Error>> + MaybeSend {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_async_fn
help: make the function `async` and return the output of the future directly
    |
256 |     async fn send_ping(&mut self) -> Result<(), Self::Error> {
    |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: move the body of the async block to the enclosing function
    |
256 ~     fn send_ping(&mut self) -> impl Future<Output = Result<(), Self::Error>> + MaybeSend {
257 ~              tracing::debug!(target: LOG_TARGET, "Send ping");
258 ~              // Submit empty slice as "optional" parameter.
259 ~              let slice: &[u8] = &[];
260 ~              // Byte slice fails if the provided slice is larger than 125 bytes.
261 ~              let byte_slice = ByteSlice125::try_from(slice).expect("Empty slice should fit into ByteSlice125");
262 + 
263 ~              self.inner.send_ping(byte_slice).await?;
264 ~              self.inner.flush().await?;
265 ~              Ok(())
266 ~          }
    |

Check warning on line 242 in client/transport/src/ws/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this function can be simplified using the `async fn` syntax

warning: this function can be simplified using the `async fn` syntax
   --> client/transport/src/ws/mod.rs:242:2
    |
242 |     fn send(&mut self, body: String) -> impl Future<Output = Result<(), Self::Error>> + MaybeSend {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_async_fn
    = note: `#[warn(clippy::manual_async_fn)]` on by default
help: make the function `async` and return the output of the future directly
    |
242 |     async fn send(&mut self, body: String) -> Result<(), Self::Error> {
    |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: move the body of the async block to the enclosing function
    |
242 ~     fn send(&mut self, body: String) -> impl Future<Output = Result<(), Self::Error>> + MaybeSend {
243 ~              if body.len() > self.max_request_size as usize {
244 ~                  return Err(WsError::MessageTooLarge);
245 ~              }
246 + 
247 ~              self.inner.send_text(body).await?;
248 ~              self.inner.flush().await?;
249 ~              Ok(())
250 ~          }
    |

Check warning on line 710 in core/src/client/async_client/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this function can be simplified using the `async fn` syntax

warning: this function can be simplified using the `async fn` syntax
   --> core/src/client/async_client/mod.rs:709:2
    |
709 |       #[instrument(name = "subscribe_method", skip(self), level = "trace")]
    |       ^--------------------------------------------------------------------
    |       |
    |  _____in this procedural macro expansion
    | |
710 | |     fn subscribe_to_method<'a, N>(&self, method: &'a str) -> impl Future<Output = Result<Subscription<N>, Error>>
    | |_________________________________________________________________________________________________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_async_fn
    = note: this warning originates in the attribute macro `instrument` (in Nightly builds, run with -Z macro-backtrace for more info)

Check warning on line 660 in core/src/client/async_client/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this function can be simplified using the `async fn` syntax

warning: this function can be simplified using the `async fn` syntax
   --> core/src/client/async_client/mod.rs:654:2
    |
654 |       #[instrument(name = "subscription", fields(method = subscribe_method), skip(self, params, subscribe_method, unsubscribe_method), level = "trace")]
    |       ^-------------------------------------------------------------------------------------------------------------------------------------------------
    |       |
    |  _____in this procedural macro expansion
    | |
655 | |     fn subscribe<'a, Notif, Params>(
656 | |         &self,
657 | |         subscribe_method: &'a str,
658 | |         params: Params,
659 | |         unsubscribe_method: &'a str,
660 | |     ) -> impl Future<Output = Result<Subscription<Notif>, Error>>
    | |_________________________________________________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_async_fn
    = note: this warning originates in the attribute macro `instrument` (in Nightly builds, run with -Z macro-backtrace for more info)

Check warning on line 582 in core/src/client/async_client/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this function can be simplified using the `async fn` syntax

warning: this function can be simplified using the `async fn` syntax
   --> core/src/client/async_client/mod.rs:578:2
    |
578 |       #[instrument(name = "batch", skip(self, batch), level = "trace")]
    |       ^----------------------------------------------------------------
    |       |
    |  _____in this procedural macro expansion
    | |
579 | |     fn batch_request<'a, R>(
580 | |         &self,
581 | |         batch: BatchRequestBuilder<'a>,
582 | |     ) -> impl Future<Output = Result<BatchResponse<'a, R>, Error>>
    | |__________________________________________________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_async_fn
    = note: `#[warn(clippy::manual_async_fn)]` on by default
    = note: this warning originates in the attribute macro `instrument` (in Nightly builds, run with -Z macro-backtrace for more info)

Check warning on line 115 in proc-macros/src/render_client.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
   --> proc-macros/src/render_client.rs:115:5
    |
115 |                 return quote_spanned!(ty.span() => compile_error!("Expecting this path to end in something like 'Result<Foo, Err>'"));
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
    = note: `#[warn(clippy::needless_return)]` on by default
help: remove `return`
    |
115 -                 return quote_spanned!(ty.span() => compile_error!("Expecting this path to end in something like 'Result<Foo, Err>'"));
115 +                 quote_spanned!(ty.span() => compile_error!("Expecting this path to end in something like 'Result<Foo, Err>'"))
    |

Check warning on line 115 in proc-macros/src/render_client.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
   --> proc-macros/src/render_client.rs:115:5
    |
115 |                 return quote_spanned!(ty.span() => compile_error!("Expecting this path to end in something like 'Result<Foo, Err>'"));
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
    = note: `#[warn(clippy::needless_return)]` on by default
help: remove `return`
    |
115 -                 return quote_spanned!(ty.span() => compile_error!("Expecting this path to end in something like 'Result<Foo, Err>'"));
115 +                 quote_spanned!(ty.span() => compile_error!("Expecting this path to end in something like 'Result<Foo, Err>'"))
    |