-
-
Notifications
You must be signed in to change notification settings - Fork 163
Closed
Description
When using bail!
like this (which is a really common use case):
fn cool_function(i: i32) -> Result<i32, anyhow::Error>{
match i {
1 => Ok(1),
2 => Ok(2),
_ => anyhow::bail!("out of range"),
}
}
the nightly rust-analyzer gives this diagnostic warning:
replace <expr>; with <expr> [needless_return]
which is expected because bail!
expands roughly to return Err(...)
, which obviously triggers the above error.
Now the question is if this is better fixed in rust-analyzer (maybe introduce an exception when using macros) or in anyhow.
Metadata
Metadata
Assignees
Labels
No labels