Closed
Description
In #37388, coerce suggestions have been added. However, the system isn't very clever and will propose everything matching, wether or not it corresponds to the actual user's needs. For example:
let x: u32 = String::new();
In this case, we get len()
and capacity()
methods suggested. But in the example, we could think that the user wanted a conversion, and if this is the case, the suggestions are completely wrong.
In order to improve this, @jonathandturner proposed a safe_suggestion attribute. I agree with this proposition but a few details still need to be "fixed":
- Should we loop through "safe" methods only?
- How should we consider that a "safe" method matches the current user's need?
- If the safe_suggestion attribute is adopted, should we have to add it over every methods that would be considered as a safe suggestion?
I might have forget other potential issues so don't hesitate to add them if this is the case.