Skip to content
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

Document init of HashSet/HashMap from vector #36740

Merged
merged 7 commits into from
Sep 29, 2016
Merged

Document init of HashSet/HashMap from vector #36740

merged 7 commits into from
Sep 29, 2016

Conversation

frehberg
Copy link
Contributor

No description provided.

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @aturon (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

/// [ ("Norway", 100),
/// ("Denmark", 50),
/// ("Iceland", 10) ]
/// .iter().map(|&x| x).collect();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.cloned() can be used instead of .map(|&x| x)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment merged in

@@ -335,6 +335,20 @@ fn test_resize_policy() {
/// println!("{:?} has {} hp", viking, health);
/// }
/// ```
/// A HashMap with fixed list of elements can be initialized from vector:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"from an array"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comments have been merged in

@@ -100,6 +100,18 @@ const INITIAL_CAPACITY: usize = 32;
/// println!("{:?}", x);
/// }
/// ```
/// HashSet with fixed list of elements can be initialized from vector:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"from an array"

Copy link
Member

@steveklabnik steveklabnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some small nits!

///
/// fn main() {
/// let timber_resources: HashMap<&str, i32> =
/// [ ("Norway", 100),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the space between [( should go away

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

/// let timber_resources: HashMap<&str, i32> =
/// [ ("Norway", 100),
/// ("Denmark", 50),
/// ("Iceland", 10) ]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

/// [ ("Norway", 100),
/// ("Denmark", 50),
/// ("Iceland", 10) ]
/// .iter().cloned().collect();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does into_iter work here, rather than iter.cloned()?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, I tried

@@ -100,6 +100,18 @@ const INITIAL_CAPACITY: usize = 32;
/// println!("{:?}", x);
/// }
/// ```
/// HashSet with fixed list of elements can be initialized from an array:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you put a newline above and below this line, please?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -335,6 +335,20 @@ fn test_resize_policy() {
/// println!("{:?} has {} hp", viking, health);
/// }
/// ```
/// A HashMap with fixed list of elements can be initialized from an array:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you put a newline before and after this line please?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@frehberg
Copy link
Contributor Author

all comments merged in

@steveklabnik
Copy link
Member

@bors: r+ rollup

thank you!

@bors
Copy link
Contributor

bors commented Sep 27, 2016

📌 Commit f953d25 has been approved by steveklabnik

@frehberg
Copy link
Contributor Author

Sadly I don't have permissions to merge :( Will anybody merge this in now?

@steveklabnik
Copy link
Member

@frehberg @bors will do it automatically, you just have to wait. :) once we say r+, it's in the queue: https://buildbot.rust-lang.org/homu/queue/rust

sophiajt pushed a commit to sophiajt/rust that referenced this pull request Sep 28, 2016
Document init of HashSet/HashMap from vector
bors added a commit that referenced this pull request Sep 28, 2016
Rollup of 11 pull requests

- Successful merges: #36376, #36672, #36740, #36757, #36765, #36769, #36782, #36783, #36784, #36795, #36796
- Failed merges:
@bors bors merged commit f953d25 into rust-lang:master Sep 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants