add ResponseSender::close shortcut. #1511
clippy
2 errors, 6 warnings
Details
Results
Message level | Amount |
---|---|
Internal compiler error | 0 |
Error | 2 |
Warning | 6 |
Note | 0 |
Help | 0 |
Versions
- rustc 1.78.0-nightly (fc3800f65 2024-02-26)
- cargo 1.78.0-nightly (194a60b29 2024-02-21)
- clippy 0.1.78 (fc3800f 2024-02-26)
Annotations
Check warning on line 120 in client/src/tls/connector.rs
github-actions / clippy
non-local `impl` definition, they should be avoided as they go against expectation
warning: non-local `impl` definition, they should be avoided as they go against expectation
--> client/src/tls/connector.rs:100:5
|
100 | / impl<'n> Service<(&'n str, Box<dyn Io>)> for TlsConnector {
101 | | type Response = (Box<dyn Io>, Version);
102 | | type Error = Error;
103 | |
... |
119 | | }
120 | | }
| |_____^
|
= help: move this `impl` block outside the of the current function `rustls`
= note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
= note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
Check warning on line 73 in client/src/tls/connector.rs
github-actions / clippy
non-local `impl` definition, they should be avoided as they go against expectation
warning: non-local `impl` definition, they should be avoided as they go against expectation
--> client/src/tls/connector.rs:50:5
|
50 | / impl<'n> Service<(&'n str, Box<dyn Io>)> for SslConnector {
51 | | type Response = (Box<dyn Io>, Version);
52 | | type Error = Error;
53 | |
... |
72 | | }
73 | | }
| |_____^
|
= help: move this `impl` block outside the of the current function `openssl`
= note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
= note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
= note: `#[warn(non_local_definitions)]` on by default
Check failure on line 98 in web/src/service/file.rs
github-actions / clippy
mismatched types
error[E0308]: mismatched types
--> web/src/service/file.rs:98:66
|
98 | RouterError::NotAllowed(MethodNotAllowed(vec![Method::GET, Method::HEAD]))
| ---------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Box<Vec<Method>>`, found `Vec<Method>`
| |
| arguments to this struct are incorrect
|
= note: expected struct `std::boxed::Box<std::vec::Vec<_>>`
found struct `std::vec::Vec<_>`
= note: for more on the distinction between the stack and the heap, read https://doc.rust-lang.org/book/ch15-01-box.html, https://doc.rust-lang.org/rust-by-example/std/box.html, and https://doc.rust-lang.org/std/boxed/index.html
note: tuple struct defined here
--> /home/runner/work/xitca-web/xitca-web/http/src/util/service/route.rs:179:12
|
179 | pub struct MethodNotAllowed(pub Box<Vec<Method>>);
| ^^^^^^^^^^^^^^^^
Check failure on line 98 in web/src/service/file.rs
github-actions / clippy
mismatched types
error[E0308]: mismatched types
--> web/src/service/file.rs:98:66
|
98 | RouterError::NotAllowed(MethodNotAllowed(vec![Method::GET, Method::HEAD]))
| ---------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Box<Vec<Method>>`, found `Vec<Method>`
| |
| arguments to this struct are incorrect
|
= note: expected struct `std::boxed::Box<std::vec::Vec<_>>`
found struct `std::vec::Vec<_>`
= note: for more on the distinction between the stack and the heap, read https://doc.rust-lang.org/book/ch15-01-box.html, https://doc.rust-lang.org/rust-by-example/std/box.html, and https://doc.rust-lang.org/std/boxed/index.html
note: tuple struct defined here
--> /home/runner/work/xitca-web/xitca-web/http/src/util/service/route.rs:179:12
|
179 | pub struct MethodNotAllowed(pub Box<Vec<Method>>);
| ^^^^^^^^^^^^^^^^
Check warning on line 232 in http/src/util/service/route.rs
github-actions / clippy
`Box::new(_)` of default value
warning: `Box::new(_)` of default value
--> http/src/util/service/route.rs:232:54
|
232 | Err(RouterError::NotAllowed(MethodNotAllowed(Box::new(Vec::new()))))
| ^^^^^^^^^^^^^^^^^^^^ help: try: `Box::default()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#box_default
= note: `#[warn(clippy::box_default)]` on by default
Check warning on line 232 in http/src/util/service/route.rs
github-actions / clippy
`Box::new(_)` of default value
warning: `Box::new(_)` of default value
--> http/src/util/service/route.rs:232:54
|
232 | Err(RouterError::NotAllowed(MethodNotAllowed(Box::new(Vec::new()))))
| ^^^^^^^^^^^^^^^^^^^^ help: try: `Box::default()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#box_default
= note: `#[warn(clippy::box_default)]` on by default
Check warning on line 249 in http-ws/src/stream.rs
github-actions / clippy
this function can be simplified using the `async fn` syntax
warning: this function can be simplified using the `async fn` syntax
--> http-ws/src/stream.rs:246:5
|
246 | / pub fn close(
247 | | self,
248 | | reason: Option<impl Into<CloseReason> + 'static>,
249 | | ) -> impl Future<Output = Result<(), ProtocolError>> + 'static {
| |__________________________________________________________________^
|
= 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
|
246 ~ pub async fn close(
247 + self,
248 + reason: Option<impl Into<CloseReason> + 'static>,
249 ~ ) -> Result<(), ProtocolError> {
|
help: move the body of the async block to the enclosing function
|
249 | ) -> impl Future<Output = Result<(), ProtocolError>> + 'static { self.send(Message::Close(reason.map(Into::into))).await }
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Check warning on line 249 in http-ws/src/stream.rs
github-actions / clippy
this function can be simplified using the `async fn` syntax
warning: this function can be simplified using the `async fn` syntax
--> http-ws/src/stream.rs:246:5
|
246 | / pub fn close(
247 | | self,
248 | | reason: Option<impl Into<CloseReason> + 'static>,
249 | | ) -> impl Future<Output = Result<(), ProtocolError>> + 'static {
| |__________________________________________________________________^
|
= 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
|
246 ~ pub async fn close(
247 + self,
248 + reason: Option<impl Into<CloseReason> + 'static>,
249 ~ ) -> Result<(), ProtocolError> {
|
help: move the body of the async block to the enclosing function
|
249 | ) -> impl Future<Output = Result<(), ProtocolError>> + 'static { self.send(Message::Close(reason.map(Into::into))).await }
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~