-
Notifications
You must be signed in to change notification settings - Fork 726
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
instrument macro sometimes triggers clippy::let_with_type_underscore #2503
Comments
I got this issue with a function in my #[instrument(skip(headers), fields(if_none_match = ?headers.get(header::IF_NONE_MATCH)))]
pub async fn handler(uri: Uri, headers: HeaderMap) -> impl IntoResponse { In the macro expansion, a bit down I see: let __tracing_attr_fake_return: _ = ::core::panicking::panic_fmt(format_args!(
"internal error: entered unreachable code: {0}",
format_args!("this is just for type inference, and is unreachable code")
));
return __tracing_attr_fake_return; |
This only happens with tracing/tracing-attributes/src/expand.rs Lines 54 to 55 in a0126b2
Here, the return type is completely empty, so it equals _ tracing/tracing-attributes/src/expand.rs Lines 69 to 70 in a0126b2
I would love to make a PR, but I don't know if we should silence the warning with a Thanks |
Min repro on playground. This only happens if there's an impl Trait return type from my testing This lint bug is triggered on stable now and breaks CI |
I made a PR two months ago. And yes, the lint is now warn by default on rust v1.70.0. |
Bug Report
Version
v0.1.37
Platform
Linux 6.2.2-arch1-1 #1 SMP PREEMPT_DYNAMIC Fri, 03 Mar 2023 15:58:31 +0000 x86_64 GNU/Linux
Description
Clippy introduced a new lint
let_with_type_underscore
that triggers onlet pattern: _ = expression;
in rust-lang/rust-clippy#10463. It seems to trigger on#[instrument]
ed function that returnimpl Trait + 'lt
, for instance one function I saw it was the function(and naming the lifetime didn't help)
The text was updated successfully, but these errors were encountered: