fix(grpc): impl From<anyhow::Error> for Status (#212) #528
ci.yaml
on: push
test-linux
1m 21s
test-linux-aarch64
2m 23s
test-macos
11m 22s
test-windows
10m 3s
lint
42s
CI is green
1s
Annotations
27 warnings
use of `unwrap_or_else` to construct default value:
volo-grpc/src/status.rs#L454
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
|
this argument is a mutable reference, but not used mutably:
volo-thrift/src/codec/default/ttheader.rs#L502
warning: this argument is a mutable reference, but not used mutably
--> volo-thrift/src/codec/default/ttheader.rs:502:50
|
502 | pub(crate) fn encode_size<Cx: ThriftContext>(cx: &mut Cx) -> Result<usize, EncodeError> {
| ^^^^^^^ help: consider changing to: `&Cx`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut
|
this argument is a mutable reference, but not used mutably:
volo-thrift/src/codec/default/ttheader.rs#L274
warning: this argument is a mutable reference, but not used mutably
--> volo-thrift/src/codec/default/ttheader.rs:274:9
|
274 | cx: &mut Cx,
| ^^^^^^^ help: consider changing to: `&Cx`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut
= note: `#[warn(clippy::needless_pass_by_ref_mut)]` on by default
|
try not to call a closure in the expression where it is declared:
volo-thrift/src/codec/default/mod.rs#L136
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 | | // then we reserve the size of the message in the linked bytes
138 | | self.linked_bytes.reserve(malloc_size);
139 | | // after that, we encode the message into the linked bytes
... |
157 | | Ok::<(), crate::Error>(())
158 | | })()
| |____________^
|
= 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 async {
137 + // then we reserve the size of the message in the linked bytes
138 + self.linked_bytes.reserve(malloc_size);
139 + // after that, we encode the message into the linked bytes
140 + self.encoder
141 + .encode(cx, &mut self.linked_bytes, msg)
142 + .map_err(|e| {
143 + // record the error time
144 + cx.stats_mut().record_encode_end_at();
145 + e
146 + })?;
147 +
148 + cx.stats_mut().record_encode_end_at();
149 + cx.stats_mut().record_write_start_at(); // encode end is also write start
150 +
151 + self.linked_bytes
152 + .write_all_vectored(&mut self.writer)
153 + .await
154 + .map_err(TransportError::from)?;
155 + self.writer.flush().await.map_err(TransportError::from)?;
156 +
157 + Ok::<(), crate::Error>(())
158 + }
|
|
using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)`:
volo-thrift/src/client/mod.rs#L610
warning: using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)`
--> volo-thrift/src/client/mod.rs:610:13
|
610 | / cache
611 | | .pop()
612 | | .and_then(|mut cx| {
613 | | // The generated code only push the cx to the cache, we need to reset
... |
642 | | Some(cx)
643 | | })
| |__________________^
|
= 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
|
612 ~ .map(|mut cx| {
613 | // The generated code only push the cx to the cache, we need to reset
...
641 | cx.rpc_info_mut().method = Some(FastStr::from_static_str(method));
642 ~ cx
|
|
use of `or_insert_with` to construct default value:
volo-thrift/src/transport/pool/mod.rs#L540
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
|
this function has too many arguments (8/7):
volo-thrift/src/transport/pingpong/server.rs#L21
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<'_>,
... |
29 | | span_provider: SP,
30 | | ) where
| |__^
|
= 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
|
the borrowed expression implements the required traits:
volo/src/net/incoming.rs#L269
warning: the borrowed expression implements the required traits
--> volo/src/net/incoming.rs:269:34
|
269 | std::fs::remove_file(&path)?;
| ^^^^^ help: change this to: `path`
|
= 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
|
casting to the same type is unnecessary (`i32` -> `i32`):
volo/src/net/incoming.rs#L233
warning: casting to the same type is unnecessary (`i32` -> `i32`)
--> volo/src/net/incoming.rs:233:13
|
233 | libc::SOMAXCONN as i32
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `libc::SOMAXCONN`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
|
casting to the same type is unnecessary (`i32` -> `i32`):
volo/src/net/incoming.rs#L223
warning: casting to the same type is unnecessary (`i32` -> `i32`)
--> volo/src/net/incoming.rs:223:20
|
223 | return libc::SOMAXCONN as i32;
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `libc::SOMAXCONN`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
|
casting to the same type is unnecessary (`i32` -> `i32`):
volo/src/net/incoming.rs#L216
warning: casting to the same type is unnecessary (`i32` -> `i32`)
--> volo/src/net/incoming.rs:216:30
|
216 | Err(_) => return libc::SOMAXCONN as i32,
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `libc::SOMAXCONN`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
= note: `#[warn(clippy::unnecessary_cast)]` on by default
|
manual `RangeInclusive::contains` implementation:
volo/src/net/incoming.rs#L154
warning: manual `RangeInclusive::contains` implementation
--> volo/src/net/incoming.rs:154:16
|
154 | if b'0' <= c && c <= b'9' {
| ^^^^^^^^^^^^^^^^^^^^^^ help: use: `(b'0'..=b'9').contains(&c)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_range_contains
= note: `#[warn(clippy::manual_range_contains)]` on by default
|
the borrowed expression implements the required traits:
volo/src/net/incoming.rs#L269
warning: the borrowed expression implements the required traits
--> volo/src/net/incoming.rs:269:34
|
269 | std::fs::remove_file(&path)?;
| ^^^^^ help: change this to: `path`
|
= 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
|
casting to the same type is unnecessary (`i32` -> `i32`):
volo/src/net/incoming.rs#L233
warning: casting to the same type is unnecessary (`i32` -> `i32`)
--> volo/src/net/incoming.rs:233:13
|
233 | libc::SOMAXCONN as i32
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `libc::SOMAXCONN`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
|
casting to the same type is unnecessary (`i32` -> `i32`):
volo/src/net/incoming.rs#L223
warning: casting to the same type is unnecessary (`i32` -> `i32`)
--> volo/src/net/incoming.rs:223:20
|
223 | return libc::SOMAXCONN as i32;
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `libc::SOMAXCONN`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
|
casting to the same type is unnecessary (`i32` -> `i32`):
volo/src/net/incoming.rs#L216
warning: casting to the same type is unnecessary (`i32` -> `i32`)
--> volo/src/net/incoming.rs:216:30
|
216 | Err(_) => return libc::SOMAXCONN as i32,
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `libc::SOMAXCONN`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
= note: `#[warn(clippy::unnecessary_cast)]` on by default
|
manual `RangeInclusive::contains` implementation:
volo/src/net/incoming.rs#L154
warning: manual `RangeInclusive::contains` implementation
--> volo/src/net/incoming.rs:154:16
|
154 | if b'0' <= c && c <= b'9' {
| ^^^^^^^^^^^^^^^^^^^^^^ help: use: `(b'0'..=b'9').contains(&c)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_range_contains
= note: `#[warn(clippy::manual_range_contains)]` on by default
|
test-linux
This self-hosted runner is currently using runner version 2.305.0. This version is out of date. Please update to the latest version 2.307.1
|
test-linux-aarch64
This self-hosted runner is currently using runner version 2.305.0. This version is out of date. Please update to the latest version 2.307.1
|
test-windows
The following actions uses node12 which is deprecated and will be forced to run on node16: Swatinem/rust-cache@v1. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/
|
test-windows
The `save-state` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
|
test-windows
The `save-state` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
|
test-windows
The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
|
test-macos
The following actions uses node12 which is deprecated and will be forced to run on node16: Swatinem/rust-cache@v1. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/
|
test-macos
The `save-state` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
|
test-macos
The `save-state` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
|
test-macos
The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
|