]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #31359 - steveklabnik:rollup, r=steveklabnik
authorbors <bors@rust-lang.org>
Tue, 2 Feb 2016 07:28:04 +0000 (07:28 +0000)
committerbors <bors@rust-lang.org>
Tue, 2 Feb 2016 07:28:04 +0000 (07:28 +0000)
- Successful merges: #30971, #31202, #31247, #31270, #31281, #31327, #31339, #31340, #31342, #31344, #31345, #31346, #31348
- Failed merges:

src/libcollectionstest/btree/map.rs
src/libcollectionstest/btree/set.rs
src/libcollectionstest/lib.rs
src/libcollectionstest/slice.rs
src/libcollectionstest/string.rs
src/libcollectionstest/vec.rs
src/libcoretest/fmt/num.rs
src/libcoretest/iter.rs
src/libcoretest/lib.rs
src/libcoretest/num/int_macros.rs
src/libcoretest/num/uint_macros.rs

index 05d4aff108aa9142942f3b485f9dcfb457d610d6..7f368f0205b922f1b45c56e3a2e627f3cbacd77b 100644 (file)
@@ -379,6 +379,7 @@ fn test_clone() {
 }
 
 #[test]
+#[allow(dead_code)]
 fn test_variance() {
     use std::collections::btree_map::{Iter, IntoIter, Range, Keys, Values};
 
index fee183433285e305a0ae541ceeb60d6986d20164..3928804a8ed1b8c82e1819263f79bc207fa87c21 100644 (file)
@@ -256,6 +256,7 @@ fn cmp(&self, other: &Self) -> Ordering {
 }
 
 #[test]
+#[allow(dead_code)]
 fn test_variance() {
     use std::collections::btree_set::{IntoIter, Iter, Range};
 
index e57620dfb04ebf82c0afce91b67caa03833b30fa..891ca22265e990b4aadd1d016588d9053c446831 100644 (file)
@@ -8,6 +8,8 @@
 // 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;
 
index e5e15025625b5e23847f516bfa10d8a2d9ed23c5..cde7fcaaf51a29d5a4e113908ebb25fca527c024 100644 (file)
@@ -866,6 +866,7 @@ macro_rules! t {
 }
 
 #[test]
+#[allow(deprecated)]
 fn test_bytes_set_memory() {
     use std::slice::bytes::MutableByteVector;
 
index 89df77d074fdc0f1d39a41242c848309a7c3da3c..158145af2bbef52f1b389eb07353c696792f6eb1 100644 (file)
@@ -8,11 +8,27 @@
 // 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();
@@ -175,7 +191,7 @@ fn test_push_bytes() {
     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");
 }
index 554be72e4268170ea057ab10309910ef937f9b37..b799be218e624cf7d98116c213647f50c9c48632 100644 (file)
@@ -686,7 +686,7 @@ fn do_bench_push_all(b: &mut Bencher, dst_len: usize, src_len: usize) {
 
     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));
     });
index 247c3dcb9c705bd026026181607624f07cf6cd48..2d3c05ea4ab14232d327e5597eddc022a75793b2 100644 (file)
@@ -7,7 +7,6 @@
 // <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() {
@@ -153,17 +152,22 @@ fn test_format_int_twos_complement() {
 }
 
 #[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;
@@ -207,6 +211,7 @@ fn format_base_36(b: &mut Bencher) {
     }
 }
 
+#[allow(deprecated)]
 mod i32 {
     use test::Bencher;
     use core::fmt::radix;
index ba308314e9e8feb6b097afa988c0d41089cdf2de..da9062b8a92ec307e5dc06a38888037cb903327a 100644 (file)
@@ -607,15 +607,15 @@ fn test_count() {
 }
 
 #[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]
@@ -961,18 +961,18 @@ fn bench_multiple_take(b: &mut Bencher) {
 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];
index 88f1835d2cce4b42499b1f868fbf3d6697895346..f23ddea5cc99d187ee0f397ad967b3aa5553e48a 100644 (file)
@@ -8,12 +8,13 @@
 // 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;
index b1c8aec3c35e9798b9e30e030001b16e4139ee17..afcf836ad10f520c7b1cef4d3e0886334db18c2d 100644 (file)
@@ -14,6 +14,8 @@ mod tests {
     use core::$T_i::*;
     use core::isize;
     use core::ops::{Shl, Shr, Not, BitXor, BitAnd, BitOr};
+    use core::mem;
+
     use num;
 
     #[test]
@@ -85,9 +87,10 @@ fn test_count_ones() {
 
     #[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]
index 25591db64d9070bbc3c781a8a0d3d3a4b5bed9b2..daa1cc3a7f4fb860b90335063f72bcbfefab31d8 100644 (file)
@@ -15,6 +15,7 @@ mod tests {
     use num;
     use core::ops::{BitOr, BitAnd, BitXor, Shl, Shr, Not};
     use std::str::FromStr;
+    use std::mem;
 
     #[test]
     fn test_overflows() {
@@ -54,9 +55,10 @@ fn test_count_ones() {
 
     #[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]