Skip to content
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

Incorrect replace return <expr>; with <expr> diagnostic #16566

Closed
Veykril opened this issue Feb 14, 2024 · 14 comments · Fixed by #16574
Closed

Incorrect replace return <expr>; with <expr> diagnostic #16566

Veykril opened this issue Feb 14, 2024 · 14 comments · Fixed by #16574
Assignees
Labels
A-diagnostics diagnostics / error reporting C-bug Category: bug

Comments

@Veykril
Copy link
Member

Veykril commented Feb 14, 2024

return BindingsIdx(idx, nidx);

The transformation here is is not valid so the diagnostic shouldnt' trigger

@Veykril Veykril added A-diagnostics diagnostics / error reporting C-bug Category: bug labels Feb 14, 2024
@davidsemakula
Copy link
Contributor

@rustbot claim

@matze
Copy link

matze commented Feb 26, 2024

Is this really fixed? It shows up in the macro invocation in this MWE with 0.3.1860-standalone (Update: and 0.3.1868-standalone):

#[tokio::main]
async fn main() {}

@mike-lloyd03
Copy link

mike-lloyd03 commented Feb 26, 2024

I'm seeing it as well using anyhow on 5346002 2024-02-25.

if something {
    Ok(value)
} else {
    bail!("Something broke")
}

@xpe
Copy link

xpe commented Feb 26, 2024

I'm also seeing this warning when using Zed Preview 0.124.6 which is using:

rust-analyzer 0.3.1860-standalone (5346002d0 2024-02-25)
rust_analyzer_problem

@PastelStoic
Copy link

I get the same error, even with an empty main.

@ghost
Copy link

ghost commented Mar 4, 2024

I get the same error on my unpublished codebase where all the possible cases of this hint have been solved and only the required returns are present.

bors added a commit that referenced this issue Mar 4, 2024
minor: Mark remove_unnecessary_else as experimental

cc #16566 (comment) #16628

There seem to be some leftover issues with this, additionally its a style lint so it's not too nice to see for some people. We should flesh out our diagnostics stuff before adding more style lints I think
@Vrajs16

This comment was marked as spam.

@HermesSantos

This comment was marked as spam.

@Cugatay
Copy link

Cugatay commented Mar 9, 2024

Hey, I still get the same error. Is there any update?

@abbygriffiths
Copy link

Issue does not seem to be fixed. Seeing the issue on Neovim on the latest stable build of Rust + rust_analyzer

@igor-f-nevski
Copy link

Same here. Issue just appeared for me actually. Tried on Zed and Helix, not that it should matter.

@flodiebold
Copy link
Member

The commit marking the diagnostic as experimental will be included in today's release.

@matze
Copy link

matze commented Mar 11, 2024

Indeed, it's fixed. Thanks whoever contributed that 🍻

@ahmedriza
Copy link

Still getting this with rust-analyzer version:

rust-analyzer 0.0.0 (ffbc5ad993 2024-07-11)

rustc version:

rustc 1.79.0 (129f3b996 2024-06-10)

The code is just an empty main:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics diagnostics / error reporting C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.