Skip to content

Commit 80881bf

Browse files
committed
Revert "feat: to_cow_string for rope"
This reverts commit 20886ec.
1 parent 20886ec commit 80881bf

File tree

2 files changed

+1
-15
lines changed

2 files changed

+1
-15
lines changed

src/cached_source.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ impl<T> CachedSource<T> {
9494

9595
impl<T: Source + Hash + PartialEq + Eq + 'static> Source for CachedSource<T> {
9696
fn source(&self) -> Cow<str> {
97-
self.get_rope().to_cow_string()
97+
Cow::Owned(self.get_rope().to_string())
9898
}
9999

100100
fn rope(&self) -> Rope<'_> {

src/rope.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -461,20 +461,6 @@ impl<'a> Rope<'a> {
461461
}
462462
}
463463
}
464-
465-
/// Converts the rope to Cow<str>.
466-
pub fn to_cow_string(&self) -> Cow<str> {
467-
match &self.repr {
468-
Repr::Light(s) => Cow::Borrowed(s),
469-
Repr::Full(data) => {
470-
let mut s = String::with_capacity(self.len());
471-
for (chunk, _) in data.iter() {
472-
s.push_str(chunk);
473-
}
474-
Cow::Owned(s)
475-
}
476-
}
477-
}
478464
}
479465

480466
impl Hash for Rope<'_> {

0 commit comments

Comments
 (0)