- Successful merges: #30971, #31202, #31247, #31270, #31281, #31327, #31339, #31340, #31342, #31344, #31345, #31346, #31348
- Failed merges:
}
#[test]
+#[allow(dead_code)]
fn test_variance() {
use std::collections::btree_map::{Iter, IntoIter, Range, Keys, Values};
}
#[test]
+#[allow(dead_code)]
fn test_variance() {
use std::collections::btree_set::{IntoIter, Iter, Range};
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+#![deny(warnings)]
+
#![feature(ascii)]
#![feature(binary_heap_extras)]
#![feature(box_syntax)]
#![feature(collections_bound)]
#![feature(const_fn)]
#![feature(fn_traits)]
-#![feature(deque_extras)]
-#![feature(drain)]
#![feature(enumset)]
-#![feature(into_cow)]
#![feature(iter_arith)]
#![feature(pattern)]
#![feature(rand)]
-#![feature(range_inclusive)]
#![feature(rustc_private)]
#![feature(set_recovery)]
#![feature(slice_bytes)]
-#![feature(slice_splits)]
#![feature(step_by)]
#![feature(str_char)]
#![feature(str_escape)]
-#![feature(str_match_indices)]
#![feature(str_utf16)]
#![feature(test)]
#![feature(unboxed_closures)]
#![feature(unicode)]
-#![feature(vec_push_all)]
#[macro_use] extern crate log;
}
#[test]
+#[allow(deprecated)]
fn test_bytes_set_memory() {
use std::slice::bytes::MutableByteVector;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::borrow::{IntoCow, Cow};
+use std::borrow::Cow;
use std::iter::repeat;
use test::Bencher;
+pub trait IntoCow<'a, B: ?Sized> where B: ToOwned {
+ fn into_cow(self) -> Cow<'a, B>;
+}
+
+impl<'a> IntoCow<'a, str> for String {
+ fn into_cow(self) -> Cow<'a, str> {
+ Cow::Owned(self)
+ }
+}
+
+impl<'a> IntoCow<'a, str> for &'a str {
+ fn into_cow(self) -> Cow<'a, str> {
+ Cow::Borrowed(self)
+ }
+}
+
#[test]
fn test_from_str() {
let owned: Option<::std::string::String> = "string".parse().ok();
let mut s = String::from("ABC");
unsafe {
let mv = s.as_mut_vec();
- mv.push_all(&[b'D']);
+ mv.extend_from_slice(&[b'D']);
}
assert_eq!(s, "ABCD");
}
b.iter(|| {
let mut dst = dst.clone();
- dst.push_all(&src);
+ dst.extend_from_slice(&src);
assert_eq!(dst.len(), dst_len + src_len);
assert!(dst.iter().enumerate().all(|(i, x)| i == *x));
});
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use core::fmt::radix;
#[test]
fn test_format_int() {
}
#[test]
+#[allow(deprecated)]
fn test_format_radix() {
+ use core::fmt::radix;
assert!(format!("{:04}", radix(3, 2)) == "0011");
assert!(format!("{}", radix(55, 36)) == "1j");
}
#[test]
#[should_panic]
+#[allow(deprecated)]
fn test_radix_base_too_large() {
+ use core::fmt::radix;
let _ = radix(55, 37);
}
+#[allow(deprecated)]
mod u32 {
use test::Bencher;
use core::fmt::radix;
}
}
+#[allow(deprecated)]
mod i32 {
use test::Bencher;
use core::fmt::radix;
}
#[test]
-fn test_max_by() {
+fn test_max_by_key() {
let xs: &[isize] = &[-3, 0, 1, 5, -10];
- assert_eq!(*xs.iter().max_by(|x| x.abs()).unwrap(), -10);
+ assert_eq!(*xs.iter().max_by_key(|x| x.abs()).unwrap(), -10);
}
#[test]
-fn test_min_by() {
+fn test_min_by_key() {
let xs: &[isize] = &[-3, 0, 1, 5, -10];
- assert_eq!(*xs.iter().min_by(|x| x.abs()).unwrap(), 0);
+ assert_eq!(*xs.iter().min_by_key(|x| x.abs()).unwrap(), 0);
}
#[test]
fn scatter(x: i32) -> i32 { (x * 31) % 127 }
#[bench]
-fn bench_max_by(b: &mut Bencher) {
+fn bench_max_by_key(b: &mut Bencher) {
b.iter(|| {
let it = 0..100;
- it.max_by(|&x| scatter(x))
+ it.max_by_key(|&x| scatter(x))
})
}
// http://www.reddit.com/r/rust/comments/31syce/using_iterators_to_find_the_index_of_the_min_or/
#[bench]
-fn bench_max_by2(b: &mut Bencher) {
+fn bench_max_by_key2(b: &mut Bencher) {
fn max_index_iter(array: &[i32]) -> usize {
- array.iter().enumerate().max_by(|&(_, item)| item).unwrap().0
+ array.iter().enumerate().max_by_key(|&(_, item)| item).unwrap().0
}
let mut data = vec![0i32; 1638];
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+#![deny(warnings)]
+
#![feature(as_unsafe_cell)]
#![feature(borrow_state)]
#![feature(box_syntax)]
#![feature(cell_extras)]
#![feature(const_fn)]
-#![feature(core)]
#![feature(core_float)]
#![feature(core_private_bignum)]
#![feature(core_private_diy_float)]
#![feature(decode_utf16)]
#![feature(fixed_size_array)]
#![feature(float_extras)]
-#![feature(float_from_str_radix)]
#![feature(flt2dec)]
#![feature(fmt_radix)]
#![feature(iter_arith)]
#![feature(iter_arith)]
-#![feature(iter_cmp)]
-#![feature(iter_order)]
#![feature(libc)]
#![feature(nonzero)]
-#![feature(num_bits_bytes)]
#![feature(peekable_is_empty)]
#![feature(ptr_as_ref)]
#![feature(rand)]
-#![feature(range_inclusive)]
#![feature(raw)]
-#![feature(slice_bytes)]
#![feature(slice_patterns)]
#![feature(step_by)]
#![feature(test)]
#![feature(unboxed_closures)]
#![feature(unicode)]
#![feature(unique)]
-#![feature(clone_from_slice)]
extern crate core;
extern crate test;
use core::$T_i::*;
use core::isize;
use core::ops::{Shl, Shr, Not, BitXor, BitAnd, BitOr};
+ use core::mem;
+
use num;
#[test]
#[test]
fn test_count_zeros() {
- assert!(A.count_zeros() == BITS as u32 - 3);
- assert!(B.count_zeros() == BITS as u32 - 2);
- assert!(C.count_zeros() == BITS as u32 - 5);
+ let bits = mem::size_of::<$T>() * 8;
+ assert!(A.count_zeros() == bits as u32 - 3);
+ assert!(B.count_zeros() == bits as u32 - 2);
+ assert!(C.count_zeros() == bits as u32 - 5);
}
#[test]
use num;
use core::ops::{BitOr, BitAnd, BitXor, Shl, Shr, Not};
use std::str::FromStr;
+ use std::mem;
#[test]
fn test_overflows() {
#[test]
fn test_count_zeros() {
- assert!(A.count_zeros() == BITS as u32 - 3);
- assert!(B.count_zeros() == BITS as u32 - 2);
- assert!(C.count_zeros() == BITS as u32 - 5);
+ let bits = mem::size_of::<$T>() * 8;
+ assert!(A.count_zeros() == bits as u32 - 3);
+ assert!(B.count_zeros() == bits as u32 - 2);
+ assert!(C.count_zeros() == bits as u32 - 5);
}
#[test]