Skip to content

Commit 336a12e

Browse files
committed
Remove CowRcStr::into_owned
It’s pretty much useless now that the refcount is almost never one.
1 parent b806c39 commit 336a12e

File tree

1 file changed

+0
-19
lines changed

1 file changed

+0
-19
lines changed

src/cow_rc_str.rs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -96,25 +96,6 @@ impl<'a> CowRcStr<'a> {
9696
}
9797
}
9898
}
99-
100-
/// Convert into `String`, re-using an existing memory allocation if possible.
101-
#[inline]
102-
pub fn into_owned(self) -> String {
103-
let unpacked = self.unpack();
104-
105-
// Inhibit destructor: we’re taking ownership of this strong reference (if any)
106-
mem::forget(self);
107-
108-
match unpacked {
109-
Ok(s) => s.to_owned(),
110-
Err(ptr) => {
111-
let rc = unsafe {
112-
Rc::from_raw(ptr)
113-
};
114-
Rc::try_unwrap(rc).unwrap_or_else(|rc| (*rc).clone())
115-
}
116-
}
117-
}
11899
}
119100

120101
impl<'a> Clone for CowRcStr<'a> {

0 commit comments

Comments
 (0)