Skip to content

clippy::needless_return quick fix changes functionality of code #13675

@DusterTheFirst

Description

@DusterTheFirst

rust-analyzer version: 0.3.1293-standalone

rustc version: rustc 1.66.0-beta.2 (0040709e3 2022-11-20)

Reproduction code:

use std::process::ExitCode;

fn main() -> ExitCode {
    return ExitCode::SUCCESS;
}

Quick fix in question:
image

The quick ""Fix"" removes the return, but not the semicolon, thus making the value no longer get returned:
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions