As part of the endeavor that also prompted #46459, it was noticed that we never generated a suggestion for .to_owned() even where it would be appropriate. Some strategic logging in matches_return_type revealed that the result being returned by .can_sub was—
Err(
Sorts(
ExpectedFound {
expected: <_ as std::borrow::ToOwned>::Owned,
found: std::string::String
}
)
)
But in this case, ToOwned::Owned should have been String.
As part of the endeavor that also prompted #46459, it was noticed that we never generated a suggestion for
.to_owned()even where it would be appropriate. Some strategic logging inmatches_return_typerevealed that the result being returned by.can_subwas—But in this case,
ToOwned::Ownedshould have beenString.