diff options
| author | Simon Sapin <simon.sapin@exyr.org> | 2019-07-08 17:50:27 +0200 |
|---|---|---|
| committer | Simon Sapin <simon.sapin@exyr.org> | 2019-07-09 11:45:46 +0200 |
| commit | 283f6762caebb723a17ce82e1fc120928697cfb9 (patch) | |
| tree | 4d42e3dfc7e1f677d9e229186d66050ccd3e1440 /src | |
| parent | 01d93bf59523c4e5c00cf8933c551adc73953cd1 (diff) | |
| download | rust-283f6762caebb723a17ce82e1fc120928697cfb9.tar.gz rust-283f6762caebb723a17ce82e1fc120928697cfb9.zip | |
Take separator by value in `[T]::join`
Diffstat (limited to 'src')
| -rw-r--r-- | src/liballoc/slice.rs | 10 | ||||
| -rw-r--r-- | src/liballoc/str.rs | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/liballoc/slice.rs b/src/liballoc/slice.rs index d7a9f83ad24..1b18dbeda9c 100644 --- a/src/liballoc/slice.rs +++ b/src/liballoc/slice.rs @@ -510,7 +510,7 @@ impl<T> [T] { /// assert_eq!([[1, 2], [3, 4]].join(&0), [1, 2, 0, 3, 4]); /// ``` #[stable(feature = "rename_connect_to_join", since = "1.3.0")] - pub fn join<Separator: ?Sized>(&self, sep: &Separator) -> <Self as Join<Separator>>::Output + pub fn join<Separator>(&self, sep: Separator) -> <Self as Join<Separator>>::Output where Self: Join<Separator> { Join::join(self, sep) @@ -528,7 +528,7 @@ impl<T> [T] { /// ``` #[stable(feature = "rust1", since = "1.0.0")] #[rustc_deprecated(since = "1.3.0", reason = "renamed to join")] - pub fn connect<Separator: ?Sized>(&self, sep: &Separator) -> <Self as Join<Separator>>::Output + pub fn connect<Separator>(&self, sep: Separator) -> <Self as Join<Separator>>::Output where Self: Join<Separator> { Join::join(self, sep) @@ -620,14 +620,14 @@ pub trait Concat<Item: ?Sized> { /// Helper trait for [`[T]::join`](../../std/primitive.slice.html#method.join) #[unstable(feature = "slice_concat_trait", issue = "27747")] -pub trait Join<Separator: ?Sized> { +pub trait Join<Separator> { #[unstable(feature = "slice_concat_trait", issue = "27747")] /// The resulting type after concatenation type Output; /// Implementation of [`[T]::join`](../../std/primitive.slice.html#method.join) #[unstable(feature = "slice_concat_trait", issue = "27747")] - fn join(slice: &Self, sep: &Separator) -> Self::Output; + fn join(slice: &Self, sep: Separator) -> Self::Output; } #[unstable(feature = "slice_concat_ext", issue = "27747")] @@ -645,7 +645,7 @@ impl<T: Clone, V: Borrow<[T]>> Concat<T> for [V] { } #[unstable(feature = "slice_concat_ext", issue = "27747")] -impl<T: Clone, V: Borrow<[T]>> Join<T> for [V] { +impl<T: Clone, V: Borrow<[T]>> Join<&'_ T> for [V] { type Output = Vec<T>; fn join(slice: &Self, sep: &T) -> Vec<T> { diff --git a/src/liballoc/str.rs b/src/liballoc/str.rs index 726ac1907fa..f57cf96a641 100644 --- a/src/liballoc/str.rs +++ b/src/liballoc/str.rs @@ -83,7 +83,7 @@ impl<S: Borrow<str>> Concat<str> for [S] { } #[unstable(feature = "slice_concat_ext", issue = "27747")] -impl<S: Borrow<str>> Join<str> for [S] { +impl<S: Borrow<str>> Join<&'_ str> for [S] { type Output = String; fn join(slice: &Self, sep: &str) -> String { |
