-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-negativeIssue: The lint should have been triggered on code, but wasn'tIssue: The lint should have been triggered on code, but wasn't
Description
Summary
If you try to use ToString::to_string in a map function on an option, the lint does not trigger.
Lint Name
str_to_string
Reproducer
I tried this code:
pub fn m1(x: Option<&str>) -> Option<String> {
x.map(ToString::to_string)
}https://godbolt.org/z/6f8zz67ac
I expected to see this happen:
warning: `to_string()` called on a `&str`
Instead, this happened:
Lint did not trigger
Version
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-negativeIssue: The lint should have been triggered on code, but wasn'tIssue: The lint should have been triggered on code, but wasn't