Skip to content

Suggest unwrap_or_default when returning empty String in closure #9420

Closed
@xphoniex

Description

@xphoniex

Description

Clippy accepts this atm:

empty_string.unwrap_or_else(|| "".to_string());

It should suggest unwrap_or_default for this case, which is more concise:

empty_string.unwrap_or_default();

Version

No response

Additional Labels

@rustbot claim

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions