Skip to content

feat(volo-build): support workspace yml dedup_list configuration (#269) #628

feat(volo-build): support workspace yml dedup_list configuration (#269)

feat(volo-build): support workspace yml dedup_list configuration (#269) #628

GitHub Actions / clippy succeeded Dec 4, 2023 in 2s

clippy

62 warnings

Details

Results

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

Versions

  • rustc 1.76.0-nightly (9fad68599 2023-12-03)
  • cargo 1.76.0-nightly (623b78849 2023-12-02)
  • clippy 0.1.76 (9fad685 2023-12-03)

Annotations

Check warning on line 43 in examples/src/http/simple.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

single-character string constant used as pattern

warning: single-character string constant used as pattern
  --> examples/src/http/simple.rs:43:32
   |
43 |     if u.to_string().ends_with("a") {
   |                                ^^^ help: try using a `char` instead: `'a'`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_char_pattern
   = note: `#[warn(clippy::single_char_pattern)]` on by default

Check warning on line 31 in examples/src/http/simple.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

accessing first element with `request .phones.get(0)`

warning: accessing first element with `request
                 .phones.get(0)`
  --> examples/src/http/simple.rs:29:23
   |
29 |       let first_phone = request
   |  _______________________^
30 | |         .phones
31 | |         .get(0)
   | |_______________^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#get_first
   = note: `#[warn(clippy::get_first)]` on by default
help: try
   |
29 ~     let first_phone = request
30 +         .phones.first()
   |

Check warning on line 113 in volo-grpc/src/transport/connect.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

using `clone` on type `DefaultMakeTransport` which implements the `Copy` trait

warning: using `clone` on type `DefaultMakeTransport` which implements the `Copy` trait
   --> volo-grpc/src/transport/connect.rs:113:31
    |
113 |                 let mk_conn = mk_conn.clone();
    |                               ^^^^^^^^^^^^^^^ help: try dereferencing it: `*mk_conn`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy
    = note: `#[warn(clippy::clone_on_copy)]` on by default

Check warning on line 454 in volo-grpc/src/status.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

use of `unwrap_or_else` to construct default value

warning: use of `unwrap_or_else` to construct default value
   --> volo-grpc/src/status.rs:454:18
    |
454 |                 .unwrap_or_else(Bytes::new);
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default
    = note: `#[warn(clippy::unwrap_or_default)]` on by default

Check warning on line 307 in volo-http/src/route.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

you should consider adding a `Default` implementation for `MethodRouterBuilder<S>`

warning: you should consider adding a `Default` implementation for `MethodRouterBuilder<S>`
   --> volo-http/src/route.rs:303:5
    |
303 | /     pub fn new() -> Self {
304 | |         Self {
305 | |             router: MethodRouter::new(),
306 | |         }
307 | |     }
    | |_____^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try adding this
    |
299 + impl<S> Default for MethodRouterBuilder<S>
300 + where
301 +     S: Clone + Send + Sync + 'static,
302 +  {
303 +     fn default() -> Self {
304 +         Self::new()
305 +     }
306 + }
    |

Check warning on line 169 in volo-http/src/route.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

you should consider adding a `Default` implementation for `MethodRouter<S>`

warning: you should consider adding a `Default` implementation for `MethodRouter<S>`
   --> volo-http/src/route.rs:156:5
    |
156 | /     pub fn new() -> Self {
157 | |         Self {
158 | |             options: MethodEndpoint::None,
159 | |             get: MethodEndpoint::None,
...   |
168 | |         }
169 | |     }
    | |_____^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try adding this
    |
152 + impl<S> Default for MethodRouter<S>
153 + where
154 +     S: Clone + Send + Sync + 'static,
155 +  {
156 +     fn default() -> Self {
157 +         Self::new()
158 +     }
159 + }
    |

Check warning on line 50 in volo-http/src/route.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

you should consider adding a `Default` implementation for `Router<S>`

warning: you should consider adding a `Default` implementation for `Router<S>`
  --> volo-http/src/route.rs:44:5
   |
44 | /     pub fn new() -> Self {
45 | |         Self {
46 | |             matcher: Default::default(),
47 | |             routes: Default::default(),
48 | |             fallback: Fallback::from_status_code(StatusCode::NOT_FOUND),
49 | |         }
50 | |     }
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
   = note: `#[warn(clippy::new_without_default)]` on by default
help: try adding this
   |
40 + impl<S> Default for Router<S>
41 + where
42 +     S: Clone + Send + Sync + 'static,
43 +  {
44 +     fn default() -> Self {
45 +         Self::new()
46 +     }
47 + }
   |

Check warning on line 20 in volo-http/src/response.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

very complex type used. Consider factoring parts into `type` definitions

warning: very complex type used. Consider factoring parts into `type` definitions
  --> volo-http/src/response.rs:18:16
   |
18 |           inner: StreamBody<
   |  ________________^
19 | |             stream::Iter<Box<dyn Iterator<Item = Result<Frame<Bytes>, DynError>> + Send + Sync>>,
20 | |         >,
   | |_________^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity

Check warning on line 60 in volo-http/src/request.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
  --> volo-http/src/request.rs:56:5
   |
56 | /     fn from(
57 | |         cx: &HttpContext,
58 | |         body: Incoming,
59 | |         _state: &S,
60 | |     ) -> impl Future<Output = Result<Self, Response<RespBody>>> + Send {
   | |______________________________________________________________________^
   |
   = 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
   |
56 ~     async fn from(
57 +         cx: &HttpContext,
58 +         body: Incoming,
59 +         _state: &S,
60 ~     ) -> Result<Self, Response<RespBody>> {
   |
help: move the body of the async block to the enclosing function
   |
60 ~     ) -> impl Future<Output = Result<Self, Response<RespBody>>> + Send {
61 +         if !json_content_type(&cx.headers) {
62 +             return Err(Response::builder()
63 +                 .status(StatusCode::UNSUPPORTED_MEDIA_TYPE)
64 +                 .body(Bytes::new().into())
65 +                 .unwrap());
66 +         }
67 + 
68 +         match body.collect().await {
69 +             Ok(body) => {
70 +                 let body = body.to_bytes();
71 +                 match serde_json::from_slice::<T>(body.as_ref()) {
72 +                     Ok(t) => Ok(Self(t)),
73 +                     Err(e) => {
74 +                         tracing::warn!("json serialization error {e}");
75 +                         Err(Response::builder()
76 +                             .status(StatusCode::BAD_REQUEST)
77 +                             .body(Bytes::new().into())
78 +                             .unwrap())
79 +                     }
80 +                 }
81 +             }
82 +             Err(e) => {
83 +                 tracing::warn!("collect body error: {e}");
84 +                 Err(Response::builder()
85 +                     .status(StatusCode::BAD_REQUEST)
86 +                     .body(Bytes::new().into())
87 +                     .unwrap())
88 +             }
89 +         }
90 +     }
   |

Check warning on line 18 in volo-http/src/layer.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

very complex type used. Consider factoring parts into `type` definitions

warning: very complex type used. Consider factoring parts into `type` definitions
  --> volo-http/src/layer.rs:18:10
   |
18 |     ) -> FilterLayer<Box<dyn Fn(&mut HttpContext, &Request<Incoming>) -> Result<(), StatusCode>>>
   |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity
   = note: `#[warn(clippy::type_complexity)]` on by default

Check warning on line 159 in volo-thrift/src/codec/default/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

try not to call a closure in the expression where it is declared

warning: try not to call a closure in the expression where it is declared
   --> volo-thrift/src/codec/default/mod.rs:136:28
    |
136 |           let write_result = (|| async {
    |  ____________________________^
137 | |             self.linked_bytes.reset();
138 | |             // then we reserve the size of the message in the linked bytes
139 | |             self.linked_bytes.reserve(malloc_size);
...   |
158 | |             Ok::<(), crate::Error>(())
159 | |         })()
    | |____________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure_call
    = note: `#[warn(clippy::redundant_closure_call)]` on by default
help: try doing something like
    |
136 ~         let write_result = async {
137 +             self.linked_bytes.reset();
138 +             // then we reserve the size of the message in the linked bytes
139 +             self.linked_bytes.reserve(malloc_size);
140 +             // after that, we encode the message into the linked bytes
141 +             self.encoder
142 +                 .encode(cx, &mut self.linked_bytes, msg)
143 +                 .map_err(|e| {
144 +                     // record the error time
145 +                     cx.stats_mut().record_encode_end_at();
146 +                     e
147 +                 })?;
148 + 
149 +             cx.stats_mut().record_encode_end_at();
150 +             cx.stats_mut().record_write_start_at(); // encode end is also write start
151 + 
152 +             self.linked_bytes
153 +                 .write_all_vectored(&mut self.writer)
154 +                 .await
155 +                 .map_err(TransportError::from)?;
156 +             self.writer.flush().await.map_err(TransportError::from)?;
157 + 
158 +             Ok::<(), crate::Error>(())
159 +         }
    |

Check warning on line 136 in volo-thrift/src/codec/default/ttheader.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
   --> volo-thrift/src/codec/default/ttheader.rs:136:13
    |
136 |             return self.inner.decode_async(cx, reader).await;
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
    |
136 -             return self.inner.decode_async(cx, reader).await;
136 +             self.inner.decode_async(cx, reader).await
    |

Check warning on line 140 in volo-thrift/src/codec/default/framed.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
   --> volo-thrift/src/codec/default/framed.rs:140:13
    |
140 |             return self.inner.decode_async(cx, reader).await;
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = 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`
    |
140 -             return self.inner.decode_async(cx, reader).await;
140 +             self.inner.decode_async(cx, reader).await
    |

Check warning on line 640 in volo-thrift/src/client/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)`

warning: using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)`
   --> volo-thrift/src/client/mod.rs:607:13
    |
607 | /             cache
608 | |                 .pop()
609 | |                 .and_then(|mut cx| {
610 | |                     // The generated code only push the cx to the cache, we need to reset
...   |
639 | |                     Some(cx)
640 | |                 })
    | |__________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bind_instead_of_map
    = note: `#[warn(clippy::bind_instead_of_map)]` on by default
help: try
    |
609 ~                 .map(|mut cx| {
610 |                     // The generated code only push the cx to the cache, we need to reset
  ...
638 |                     cx.rpc_info_mut().method = Some(FastStr::from_static_str(method));
639 ~                     cx
    |

Check warning on line 540 in volo-thrift/src/transport/pool/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

use of `or_insert_with` to construct default value

warning: use of `or_insert_with` to construct default value
   --> volo-thrift/src/transport/pool/mod.rs:540:45
    |
540 |             let idle = self.idle.entry(key).or_insert_with(Vec::new);
    |                                             ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default
    = note: `#[warn(clippy::unwrap_or_default)]` on by default

Check warning on line 37 in volo-thrift/src/transport/pingpong/server.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this function has too many arguments (8/7)

warning: this function has too many arguments (8/7)
  --> volo-thrift/src/transport/pingpong/server.rs:21:1
   |
21 | / pub async fn serve<Svc, Req, Resp, E, D, SP>(
22 | |     mut encoder: E,
23 | |     mut decoder: D,
24 | |     notified: Notified<'_>,
...  |
36 | |     D: Decoder,
37 | |     SP: SpanProvider,
   | |_____________________^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments
   = note: `#[warn(clippy::too_many_arguments)]` on by default

Check warning on line 302 in volo-thrift/src/error.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

use of a fallible conversion when an infallible one could be used

warning: use of a fallible conversion when an infallible one could be used
   --> volo-thrift/src/error.rs:302:61
    |
302 |                     let remote_kind: ApplicationErrorKind = TryFrom::try_from(remote_type_as_int)
    |                                                             ^^^^^^^^^^^^^^^^^ help: use: `From::from`
    |
    = note: converting `i32` to `ApplicationErrorKind` cannot fail
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_fallible_conversions

Check warning on line 261 in volo-thrift/src/error.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

use of a fallible conversion when an infallible one could be used

warning: use of a fallible conversion when an infallible one could be used
   --> volo-thrift/src/error.rs:261:61
    |
261 |                     let remote_kind: ApplicationErrorKind = TryFrom::try_from(remote_type_as_int)
    |                                                             ^^^^^^^^^^^^^^^^^ help: use: `From::from`
    |
    = note: converting `i32` to `ApplicationErrorKind` cannot fail
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_fallible_conversions
    = note: `#[warn(clippy::unnecessary_fallible_conversions)]` on by default

Check warning on line 3 in volo-thrift/src/protocol/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused imports: `TFieldIdentifier`, `TListIdentifier`, `TMapIdentifier`, `TSetIdentifier`, `TStructIdentifier`, `TType`

warning: unused imports: `TFieldIdentifier`, `TListIdentifier`, `TMapIdentifier`, `TSetIdentifier`, `TStructIdentifier`, `TType`
 --> volo-thrift/src/protocol/mod.rs:3:13
  |
3 |     binary, TFieldIdentifier, TInputProtocol, TLengthProtocol, TListIdentifier, TMapIdentifier,
  |             ^^^^^^^^^^^^^^^^                                   ^^^^^^^^^^^^^^^  ^^^^^^^^^^^^^^
4 |     TMessageIdentifier, TMessageType, TOutputProtocol, TSetIdentifier, TStructIdentifier, TType,
  |                                                        ^^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^^^  ^^^^^

Check warning on line 1 in volo-thrift/src/protocol/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused import: `binary::TBinaryProtocol`

warning: unused import: `binary::TBinaryProtocol`
 --> volo-thrift/src/protocol/mod.rs:1:9
  |
1 | pub use binary::TBinaryProtocol;
  |         ^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

Check warning on line 53 in volo/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
  --> volo/src/client.rs:49:5
   |
49 | /     fn call<'cx>(
50 | |         self,
51 | |         cx: &'cx mut Cx,
52 | |         req: Req,
53 | |     ) -> impl Future<Output = Result<Self::Response, Self::Error>> + Send {
   | |_________________________________________________________________________^
   |
   = 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
   |
49 ~     async fn call<'cx>(
50 +         self,
51 +         cx: &'cx mut Cx,
52 +         req: Req,
53 ~     ) -> Result<Self::Response, Self::Error> {
   |
help: move the body of the async block to the enclosing function
   |
53 ~     ) -> impl Future<Output = Result<Self::Response, Self::Error>> + Send {
54 +         self.opt.apply(cx)?;
55 +         self.inner.call(cx, req).await
56 +     }
   |

Check warning on line 49 in volo/src/client.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

the following explicit lifetimes could be elided: 'cx

warning: the following explicit lifetimes could be elided: 'cx
  --> volo/src/client.rs:49:13
   |
49 |     fn call<'cx>(
   |             ^^^
50 |         self,
51 |         cx: &'cx mut Cx,
   |              ^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
   |
49 ~     fn call'_>(
50 |         self,
51 ~         cx: &mut Cx,
   |

Check warning on line 30 in volo/src/client.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

the following explicit lifetimes could be elided: 'cx

warning: the following explicit lifetimes could be elided: 'cx
  --> volo/src/client.rs:30:13
   |
30 |     fn call<'cx>(
   |             ^^^
31 |         self,
32 |         cx: &'cx mut Cx,
   |              ^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
   = note: `#[warn(clippy::needless_lifetimes)]` on by default
help: elide the lifetimes
   |
30 ~     fn call'_>(
31 |         self,
32 ~         cx: &mut Cx,
   |

Check warning on line 415 in volo/src/hotrestart/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
   --> volo/src/hotrestart/mod.rs:415:17
    |
415 |                 return Err(e);
    |                 ^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
    |
415 -                 return Err(e);
415 +                 Err(e)
    |

Check warning on line 412 in volo/src/hotrestart/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
   --> volo/src/hotrestart/mod.rs:409:17
    |
409 | /                 return Err(io::Error::new(
410 | |                     io::ErrorKind::InvalidData,
411 | |                     "Not PassFdResponse",
412 | |                 ));
    | |__________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
    |
409 ~                 Err(io::Error::new(
410 +                     io::ErrorKind::InvalidData,
411 +                     "Not PassFdResponse",
412 ~                 ))
    |