Open
Description
Bug Report
While testing the rust 1.87 beta toolchain, I noticed that clippy now raises warnings on any code that uses tonic::Result
or otherwise contains a tonic::Status
in its Err
variant. The result_large_err
lint is enabled by default.
I don't have an opinion about whether clippy's thresholds are correct; just wanted to give the tonic developers a heads-up as this will probably trigger warnings in a lot of downstream code that uses tonic.
Version
tonic v0.13.0 (also happens with tonic 0.12.3).
Description
Here's a trivial example that shows the warnings:
pub fn thing1() -> tonic::Result<()> {
Ok(())
}
cargo +beta clippy
says:
warning: the `Err`-variant returned from this function is very large
--> src/lib.rs:1:19
|
1 | pub fn hello() -> tonic::Result<()> {
| ^^^^^^^^^^^^^^^^^ the `Err`-variant is at least 176 bytes
|
= help: try reducing the size of `tonic::Status`, for example by boxing large elements or replacing it with `Box<tonic::Status>`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#result_large_err
= note: `#[warn(clippy::result_large_err)]` on by default
Or alternatively, without explicitly using tonic::Result
but propagating the error type:
pub enum MyError {
Oops,
Tonic(tonic::Status),
}
pub fn thing2() -> Result<(), MyError> {
Ok(())
}
warning: the `Err`-variant returned from this function is very large
--> src/lib.rs:6:20
|
3 | Tonic(tonic::Status),
| -------------------- the largest variant contains at least 176 bytes
...
6 | pub fn thing2() -> Result<(), MyError> {
| ^^^^^^^^^^^^^^^^^^^
|
= help: try reducing the size of `MyError`, for example by boxing large elements or replacing it with `Box<MyError>`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#result_large_err
= note: `#[warn(clippy::result_large_err)]` on by default
Metadata
Metadata
Assignees
Labels
No labels