Skip to content

Commit 3a8536e

Browse files
authored
Rollup merge of #61146 - czipperz:SliceConcatExt-connect-default-to-join, r=sfackler
SliceConcatExt::connect defaults to calling join It makes sense to default a deprecated method to the new one. Precedence example is `Error::cause` defaults to calling `Error::source`.
2 parents f2a0ce9 + 3dd114e commit 3a8536e

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

Diff for: src/liballoc/slice.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,9 @@ pub trait SliceConcatExt<T: ?Sized> {
581581
/// ```
582582
#[stable(feature = "rust1", since = "1.0.0")]
583583
#[rustc_deprecated(since = "1.3.0", reason = "renamed to join")]
584-
fn connect(&self, sep: &T) -> Self::Output;
584+
fn connect(&self, sep: &T) -> Self::Output {
585+
self.join(sep)
586+
}
585587
}
586588

587589
#[unstable(feature = "slice_concat_ext",
@@ -615,10 +617,6 @@ impl<T: Clone, V: Borrow<[T]>> SliceConcatExt<T> for [V] {
615617
}
616618
result
617619
}
618-
619-
fn connect(&self, sep: &T) -> Vec<T> {
620-
self.join(sep)
621-
}
622620
}
623621

624622
////////////////////////////////////////////////////////////////////////////////

Diff for: src/liballoc/str.rs

-4
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,6 @@ impl<S: Borrow<str>> SliceConcatExt<str> for [S] {
8686
String::from_utf8_unchecked( join_generic_copy(self, sep.as_bytes()) )
8787
}
8888
}
89-
90-
fn connect(&self, sep: &str) -> String {
91-
self.join(sep)
92-
}
9389
}
9490

9591
macro_rules! spezialize_for_lengths {

0 commit comments

Comments
 (0)