Skip to content

Rollup of 7 pull requests #87943

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 22 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
5056844
Implement Extend<(A, B)> for (impl Extend<A>, impl Extend<B>)
Seppel3210 May 30, 2021
b5e9275
Rewrite Iterator::unzip in terms of (A, B)::extend
Seppel3210 May 30, 2021
c8f5d6d
Merge branch 'master' of https://github.com/rust-lang/rust
Seppel3210 Jun 12, 2021
96b7d07
Mention nested unzip in its documentation
Seppel3210 Jun 14, 2021
7b90759
Add documentation/example to Extend impl
Seppel3210 Jun 20, 2021
3d0c5d0
Update library/core/src/iter/traits/collect.rs
yaahc Aug 3, 2021
260f9b9
Link to edition guide instead of issues for 2021 lints.
m-ou-se Aug 9, 2021
62b8a5e
Reduce verbosity of RUSTC_LOG
jackh726 Aug 10, 2021
b7b0291
Move some UI tests to more suitable subdirs
JohnTitor Jul 29, 2021
107ed0a
Update books
ehuss Aug 10, 2021
e62cd40
Update cargo
ehuss Aug 10, 2021
a03fbfe
Warn when an escaped newline skips multiple lines
jesyspa Jul 31, 2021
2dff700
Update format string tests to explicitly escape multiple newlines
jesyspa Jul 31, 2021
efe069c
Add UI tests for string escape warnings.
jesyspa Aug 11, 2021
07aacf5
Renamed variable str -> tail for clarity
jesyspa Aug 11, 2021
9979921
Rollup merge of #85835 - Seppel3210:master, r=yaahc
JohnTitor Aug 11, 2021
76a4510
Rollup merge of #87600 - JohnTitor:classify-ui-tests, r=petrochenkov
JohnTitor Aug 11, 2021
94cb4e7
Rollup merge of #87671 - jesyspa:issue-87319-multiple-newlines, r=est…
JohnTitor Aug 11, 2021
3144602
Rollup merge of #87885 - m-ou-se:edition-guide-links, r=rylev
JohnTitor Aug 11, 2021
10a567e
Rollup merge of #87903 - jackh726:logging-cleanup, r=oli-obk
JohnTitor Aug 11, 2021
a290246
Rollup merge of #87925 - ehuss:update-books, r=ehuss
JohnTitor Aug 11, 2021
dd6ff48
Rollup merge of #87928 - ehuss:update-cargo, r=ehuss
JohnTitor Aug 11, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add documentation/example to Extend impl
  • Loading branch information
Seppel3210 committed Jun 20, 2021
commit 7b907597332e430653673531e2bc29b1ae286f3c
20 changes: 19 additions & 1 deletion library/core/src/iter/traits/collect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,12 +359,30 @@ impl Extend<()> for () {
fn extend_one(&mut self, _item: ()) {}
}

#[stable(feature = "extend_for_tuple", since = "1.54.0")]
#[stable(feature = "extend_for_tuple", since = "1.55.0")]
impl<A, B, ExtendA, ExtendB> Extend<(A, B)> for (ExtendA, ExtendB)
where
ExtendA: Extend<A>,
ExtendB: Extend<B>,
{
/// Allows to `extend` a tuple of collections that also implement `Extend`.
///
/// See also: [`Iterator::unzip`]
///
/// # Examples
/// ```
/// let mut tuple = (vec![0], vec![1]);
/// tuple.extend(vec![(2, 3), (4, 5), (6, 7)]);
/// assert_eq!(tuple.0, vec![0, 2, 4, 6]);
/// assert_eq!(tuple.1, vec![1, 3, 5, 7]);
///
/// // also allows for arbitrarily nested tuples
/// let mut nested_tuple = (vec![(1, -1)], vec![(2, -2)]);
/// nested_tuple.extend(vec![((3, -3), (4, -4)), ((5, -5), (6, -6))]);
///
/// assert_eq!(nested_tuple.0, vec![(1, -1), (3, -3), (5, -5)]);
/// assert_eq!(nested_tuple.1, vec![(2, -2), (4, -4), (6, -6)]);
/// ```
fn extend<T: IntoIterator<Item = (A, B)>>(&mut self, into_iter: T) {
let (a, b) = self;
let iter = into_iter.into_iter();
Expand Down