Turn Cow::is_borrowed,is_owned
into associated functions. by theemathas · Pull Request #138217 · rust-lang/rust (original) (raw)
So, +1 for documenting that users might want to call the functions this way if there's a conflict and they want to be explicit, but -1 for forcing the functions to be called this way. Yes, I understand that Cow implements Deref and these would shadow inner functions. However, we already have some methods on Cow: into_owned
and to_mut
. This doesn't in practice seem to pose a problem.
Did a crater run turn up some issue with these two new methods?
I also think these two new methods aren't especially useful if they can't be written in postfix form; at that point, you're not far off from just using matches!
or let chains or waiting for is
. So if there's some issue that stops us from making these methods, I think we should remove them entirely.