Skip to content

FN needless_return: "return" at end of void-function #4181

Closed
@matthiaskrgr

Description

@matthiaskrgr

If we have a function that does not return a type and has return as last statement, we could suggest that that return could be omitted:

pub fn a() {
	println!("blurb");
	return; // unneeded
}

pub fn b() {
	println!("blarb");
	return // unneeded
}

=>

pub fn a() {
	println!("blurb");
}

pub fn b() {
	println!("blarb");
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesL-suggestionLint: Improving, adding or fixing lint suggestions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions