Skip to content

TreeMap examples fixes #15749

New issue

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

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

Already on GitHub? # to your account

Merged
merged 1 commit into from
Jul 23, 2014
Merged

TreeMap examples fixes #15749

merged 1 commit into from
Jul 23, 2014

Conversation

vhbit
Copy link
Contributor

@vhbit vhbit commented Jul 17, 2014

  1. Removed obsolete comment regarding recursive/iteration implementations of tree_find_with/tree_find_mut_with
  2. Replaced easy breakable find_with example with simpler one (which only removes redundant allocation during search)

@olivren
Copy link
Contributor

olivren commented Jul 18, 2014

Changing the example is a good thing. However, there really should be a warning note to explain the restrictions that exist on this method. Here is my proposition:

Beware that this method is not a general purpose find implementation. It exists only as a mean to optimize a call to the regular find method, by allowing the caller to avoid performing a type conversion if it is not necessary. This method cannot be used to provide an alternative ordering logic (for example, searching a String key case-insensitively).

I'm not a native english speaker, so anyone feel free to correct it.

@@ -913,14 +917,9 @@ fn split<K: Ord, V>(node: &mut Box<TreeNode<K, V>>) {
}
}

// Next 2 functions have the same conventions
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for fixing this! :D

1. Removed obsolete comment regarding recursive/iteration implementations of tree_find_with/tree_find_mut_with
2. Replaced easy breakable find_with example with simpler one (which only removes redundant allocation during search)
@vhbit
Copy link
Contributor Author

vhbit commented Jul 23, 2014

Added a warning about natural ordering, squashed commits

bors added a commit that referenced this pull request Jul 23, 2014
1. Removed obsolete comment regarding recursive/iteration implementations of tree_find_with/tree_find_mut_with
2. Replaced easy breakable find_with example with simpler one (which only removes redundant allocation during search)
@bors bors closed this Jul 23, 2014
@bors bors merged commit 4a00d4e into rust-lang:master Jul 23, 2014
@vhbit vhbit deleted the treemap-doc-fixes branch August 1, 2014 19:30
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants