Description
I previously landed a clarification that this lint is not always correct, depending on the use-case: #6090
Today I discovered that Rc::make_mut()
and Arc::make_mut()
exist for Rc<T: Clone>
and Arc<T: Clone>
respectively.
The rc_buffer
lint says that you can only get a mutable reference if there are no mutable references or else panic, which is not true due to these functions. Copy-on-write is perfectly reasonable for types which are Clone
. See also http-rs/tide#747.
I'm willing to make a change to only have this lint apply when T
is not Clone
if someone can point me in the direction of how to do that. It looks like there are 4 lint sites, two of which are for slices. The lint should also be updated to mention make_mut
, which could be done either in the same PR or separately.