Skip to content

Commit 257212a

Browse files
committed
Remove warnings from tests.
1 parent 2ba46f8 commit 257212a

File tree

20 files changed

+64
-62
lines changed

20 files changed

+64
-62
lines changed

src/libcoretest/iter.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,7 @@ fn test_inspect() {
452452
}
453453

454454
#[test]
455+
#[allow(deprecated)]
455456
fn test_unfoldr() {
456457
fn count(st: &mut usize) -> Option<usize> {
457458
if *st < 10 {
@@ -782,6 +783,7 @@ fn test_rposition_panic() {
782783

783784

784785
#[cfg(test)]
786+
#[allow(deprecated)]
785787
fn check_randacc_iter<A, T>(a: T, len: usize) where
786788
A: PartialEq,
787789
T: Clone + RandomAccessIterator + Iterator<Item=A>,
@@ -821,6 +823,7 @@ fn test_double_ended_flat_map() {
821823
}
822824

823825
#[test]
826+
#[allow(deprecated)]
824827
fn test_random_access_chain() {
825828
let xs = [1, 2, 3, 4, 5];
826829
let ys = [7, 9, 11];
@@ -884,6 +887,7 @@ fn test_random_access_skip() {
884887
}
885888

886889
#[test]
890+
#[allow(deprecated)]
887891
fn test_random_access_inspect() {
888892
let xs = [1, 2, 3, 4, 5];
889893

@@ -897,6 +901,7 @@ fn test_random_access_inspect() {
897901
}
898902

899903
#[test]
904+
#[allow(deprecated)]
900905
fn test_random_access_map() {
901906
let xs = [1, 2, 3, 4, 5];
902907

@@ -985,12 +990,19 @@ fn test_range_step() {
985990
}
986991

987992
#[test]
988-
fn test_reverse() {
993+
#[allow(deprecated)]
994+
fn test_reverse_in_place() {
989995
let mut ys = [1, 2, 3, 4, 5];
990996
ys.iter_mut().reverse_in_place();
991997
assert!(ys == [5, 4, 3, 2, 1]);
992998
}
993999

1000+
#[test]
1001+
fn test_reverse() {
1002+
let ys = [1, 2, 3, 4, 5].iter().cloned().rev().collect::<Vec<_>>();
1003+
assert_eq!(&ys, &[5, 4, 3, 2, 1]);
1004+
}
1005+
9941006
#[test]
9951007
fn test_peekable_is_empty() {
9961008
let a = [1];
@@ -1031,6 +1043,7 @@ fn test_min_max_result() {
10311043
}
10321044

10331045
#[test]
1046+
#[allow(deprecated)]
10341047
fn test_iterate() {
10351048
let mut it = iterate(1, |x| x * 2);
10361049
assert_eq!(it.next(), Some(1));

src/libstd/fs.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1311,7 +1311,6 @@ mod tests {
13111311
use io::{ErrorKind, SeekFrom};
13121312
use path::PathBuf;
13131313
use path::Path as Path2;
1314-
use os;
13151314
use rand::{self, StdRng, Rng};
13161315
use str;
13171316

src/libstd/io/buffered.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,7 @@ mod tests {
741741
// This is just here to make sure that we don't infinite loop in the
742742
// newtype struct autoderef weirdness
743743
#[test]
744+
#[allow(deprecated)]
744745
fn test_buffered_stream() {
745746
struct S;
746747

@@ -892,6 +893,7 @@ mod tests {
892893
}
893894

894895
#[bench]
896+
#[allow(deprecated)]
895897
fn bench_buffered_stream(b: &mut test::Bencher) {
896898
let mut buf = Cursor::new(Vec::new());
897899
b.iter(|| {

src/libstd/io/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ mod test {
309309
struct TestError;
310310

311311
impl fmt::Display for TestError {
312-
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
312+
fn fmt(&self, _fmt: &mut fmt::Formatter) -> fmt::Result {
313313
Ok(())
314314
}
315315
}

src/libstd/net/addr.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -458,9 +458,7 @@ impl<'a, T: ToSocketAddrs + ?Sized> ToSocketAddrs for &'a T {
458458
#[cfg(test)]
459459
mod tests {
460460
use prelude::v1::*;
461-
use io;
462461
use net::*;
463-
use net::Ipv6MulticastScope::*;
464462
use net::test::{tsa, sa6, sa4};
465463

466464
#[test]

src/libstd/net/ip.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,6 @@ impl FromInner<libc::in6_addr> for Ipv6Addr {
514514
#[cfg(test)]
515515
mod tests {
516516
use prelude::v1::*;
517-
use io;
518517
use net::*;
519518
use net::Ipv6MulticastScope::*;
520519
use net::test::{tsa, sa6, sa4};

src/libstd/net/tcp.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -908,7 +908,7 @@ mod tests {
908908
#[test]
909909
fn timeouts() {
910910
let addr = next_test_ip4();
911-
let listener = t!(TcpListener::bind(&addr));
911+
let _listener = t!(TcpListener::bind(&addr));
912912

913913
let stream = t!(TcpStream::connect(&("localhost", addr.port())));
914914
let dur = Duration::new(15410, 0);
@@ -933,7 +933,7 @@ mod tests {
933933
#[test]
934934
fn test_read_timeout() {
935935
let addr = next_test_ip4();
936-
let listener = t!(TcpListener::bind(&addr));
936+
let _listener = t!(TcpListener::bind(&addr));
937937

938938
let mut stream = t!(TcpStream::connect(&("localhost", addr.port())));
939939
t!(stream.set_read_timeout(Some(Duration::from_millis(1000))));

src/libstd/net/udp.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ mod tests {
391391
fn test_read_timeout() {
392392
let addr = next_test_ip4();
393393

394-
let mut stream = t!(UdpSocket::bind(&addr));
394+
let stream = t!(UdpSocket::bind(&addr));
395395
t!(stream.set_read_timeout(Some(Duration::from_millis(1000))));
396396

397397
let mut buf = [0; 10];
@@ -407,7 +407,7 @@ mod tests {
407407
fn test_read_with_timeout() {
408408
let addr = next_test_ip4();
409409

410-
let mut stream = t!(UdpSocket::bind(&addr));
410+
let stream = t!(UdpSocket::bind(&addr));
411411
t!(stream.set_read_timeout(Some(Duration::from_millis(1000))));
412412

413413
t!(stream.send_to(b"hello world", &addr));

src/libstd/num/f32.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@
1515
#![allow(unsigned_negation)]
1616
#![doc(primitive = "f32")]
1717

18-
use prelude::v1::*;
19-
20-
use core::num;
21-
use intrinsics;
22-
use libc::c_int;
23-
use num::{FpCategory, ParseFloatError};
18+
#[cfg(not(test))] use prelude::v1::*;
19+
#[cfg(not(test))] use core::num;
20+
#[cfg(not(test))] use intrinsics;
21+
#[cfg(not(test))] use libc::c_int;
22+
#[cfg(not(test))] use num::{FpCategory, ParseFloatError};
2423

2524
pub use core::f32::{RADIX, MANTISSA_DIGITS, DIGITS, EPSILON};
2625
pub use core::f32::{MIN_EXP, MAX_EXP, MIN_10_EXP};
@@ -1690,6 +1689,7 @@ mod tests {
16901689
}
16911690

16921691
#[test]
1692+
#[allow(deprecated)]
16931693
fn test_real_consts() {
16941694
use super::consts;
16951695

src/libstd/num/f64.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,11 @@
1414
#![allow(missing_docs)]
1515
#![doc(primitive = "f64")]
1616

17-
use prelude::v1::*;
18-
19-
use core::num;
20-
use intrinsics;
21-
use libc::c_int;
22-
use num::{FpCategory, ParseFloatError};
17+
#[cfg(not(test))] use prelude::v1::*;
18+
#[cfg(not(test))] use core::num;
19+
#[cfg(not(test))] use intrinsics;
20+
#[cfg(not(test))] use libc::c_int;
21+
#[cfg(not(test))] use num::{FpCategory, ParseFloatError};
2322

2423
pub use core::f64::{RADIX, MANTISSA_DIGITS, DIGITS, EPSILON};
2524
pub use core::f64::{MIN_EXP, MAX_EXP, MIN_10_EXP};
@@ -1646,6 +1645,7 @@ mod tests {
16461645
}
16471646

16481647
#[test]
1648+
#[allow(deprecated)]
16491649
fn test_real_consts() {
16501650
use super::consts;
16511651
let pi: f64 = consts::PI;

0 commit comments

Comments
 (0)