Skip to content

Commit

Permalink
Rollup merge of rust-lang#61146 - czipperz:SliceConcatExt-connect-def…
Browse files Browse the repository at this point in the history
…ault-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`.
  • Loading branch information
Centril authored Jun 21, 2019
2 parents f2a0ce9 + 3dd114e commit 3a8536e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
8 changes: 3 additions & 5 deletions src/liballoc/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,9 @@ pub trait SliceConcatExt<T: ?Sized> {
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_deprecated(since = "1.3.0", reason = "renamed to join")]
fn connect(&self, sep: &T) -> Self::Output;
fn connect(&self, sep: &T) -> Self::Output {
self.join(sep)
}
}

#[unstable(feature = "slice_concat_ext",
Expand Down Expand Up @@ -615,10 +617,6 @@ impl<T: Clone, V: Borrow<[T]>> SliceConcatExt<T> for [V] {
}
result
}

fn connect(&self, sep: &T) -> Vec<T> {
self.join(sep)
}
}

////////////////////////////////////////////////////////////////////////////////
Expand Down
4 changes: 0 additions & 4 deletions src/liballoc/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,6 @@ impl<S: Borrow<str>> SliceConcatExt<str> for [S] {
String::from_utf8_unchecked( join_generic_copy(self, sep.as_bytes()) )
}
}

fn connect(&self, sep: &str) -> String {
self.join(sep)
}
}

macro_rules! spezialize_for_lengths {
Expand Down

0 comments on commit 3a8536e

Please sign in to comment.