Skip to content

Suggest removing semicolon at the end of non-unit function #21838

Closed
@jody-frankowski

Description

@jody-frankowski
fn add(a: i32, b: i32) -> i64 {
    a + b;
}

With this code, rustc doesn't print a message such as:

help: consider removing this semicolon:
a + b;

It only prints

error: not all control paths return a value [E0269]

rustc 1.0.0-nightly (c5961ad06 2015-01-28 21:49:38 +0000)
binary: rustc
commit-hash: c5961ad06d45689b44ff305c15d6ec7ec65755a9
commit-date: 2015-01-28 21:49:38 +0000
host: x86_64-unknown-linux-gnu
release: 1.0.0-nightly

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions