fix up tests

This commit is contained in:
djzin 2016-12-24 16:17:22 +00:00
parent c72605ac62
commit 14b0ea8aa6
3 changed files with 17 additions and 13 deletions

View File

@ -674,10 +674,10 @@ impl<K: Ord, V> BTreeMap<K, V> {
/// map.insert(3, "a");
/// map.insert(5, "b");
/// map.insert(8, "c");
/// for (&key, &value) in map.range(Included(&4), Included(&8)) {
/// for (&key, &value) in map.range((Included(&4), Included(&8))) {
/// println!("{}: {}", key, value);
/// }
/// assert_eq!(Some((&5, &"b")), map.range(Included(&4), Unbounded).next());
/// assert_eq!(Some((&5, &"b")), map.range((Included(&4), Unbounded)).next());
/// ```
#[unstable(feature = "btree_range",
reason = "matches collection reform specification, waiting for dust to settle",

View File

@ -224,10 +224,10 @@ impl<T: Ord> BTreeSet<T> {
/// set.insert(3);
/// set.insert(5);
/// set.insert(8);
/// for &elem in set.range(Included(&4), Included(&8)) {
/// for &elem in set.range((Included(&4), Included(&8))) {
/// println!("{}", elem);
/// }
/// assert_eq!(Some(&5), set.range(Included(&4), Unbounded).next());
/// assert_eq!(Some(&5), set.range((Included(&4), Unbounded)).next());
/// ```
#[unstable(feature = "btree_range",
reason = "matches collection reform specification, waiting for dust to settle",

View File

@ -19,47 +19,51 @@ use Bound::{self, Excluded, Included, Unbounded};
/// **RangeArgument** is implemented by Rust's built-in range types, produced
/// by range syntax like `..`, `a..`, `..b` or `c..d`.
pub trait RangeArgument<T> {
/// Start index (inclusive)
pub trait RangeArgument<T: ?Sized> {
/// Start index bound
///
/// Return start value if present, else `None`.
/// Return start value as a `Bound`
///
/// # Examples
///
/// ```
/// #![feature(collections)]
/// #![feature(collections_range)]
/// #![feature(collections_bound)]
///
/// extern crate collections;
///
/// # fn main() {
/// use collections::range::RangeArgument;
/// use collections::Bound::*;
///
/// assert_eq!((..10).start(), None);
/// assert_eq!((3..10).start(), Some(&3));
/// assert_eq!((..10).start(), Unbounded);
/// assert_eq!((3..10).start(), Included(&3));
/// # }
/// ```
fn start(&self) -> Bound<&T> {
Unbounded
}
/// End index (exclusive)
/// End index bound
///
/// Return end value if present, else `None`.
/// Return end value as a `Bound`
///
/// # Examples
///
/// ```
/// #![feature(collections)]
/// #![feature(collections_range)]
/// #![feature(collections_bound)]
///
/// extern crate collections;
///
/// # fn main() {
/// use collections::range::RangeArgument;
/// use collections::Bound::*;
///
/// assert_eq!((3..).end(), None);
/// assert_eq!((3..10).end(), Some(&10));
/// assert_eq!((3..).end(), Unbounded);
/// assert_eq!((3..10).end(), Excluded(&10));
/// # }
/// ```
fn end(&self) -> Bound<&T> {