From 3f9b7f6d46a97e85179652a986635be21d6f0322 Mon Sep 17 00:00:00 2001 From: Florian Hartwig <florian.j.hartwig@gmail.com> Date: Thu, 19 Mar 2015 16:23:29 +0100 Subject: [PATCH] Fix errors and warnings with current rust nightly --- src/byte_buf.rs | 3 +-- src/lib.rs | 2 +- src/ring.rs | 3 +-- test/test_seq_byte_str.rs | 2 +- test/test_small_byte_str.rs | 2 +- 5 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/byte_buf.rs b/src/byte_buf.rs index 22ba964..e015433 100644 --- a/src/byte_buf.rs +++ b/src/byte_buf.rs @@ -1,7 +1,6 @@ use {alloc, Bytes, SeqByteStr, MAX_CAPACITY}; use traits::{Buf, MutBuf, MutBufExt, ByteStr}; use std::{cmp, ptr}; -use std::num::UnsignedInt; /* * @@ -57,7 +56,7 @@ impl ByteBuf { } // Round the capacity to the closest power of 2 - capacity = UnsignedInt::next_power_of_two(capacity); + capacity = capacity.next_power_of_two(); // Allocate the memory let mem = alloc::HEAP.allocate(capacity as usize); diff --git a/src/lib.rs b/src/lib.rs index f9885d5..70b9ded 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,7 +1,7 @@ #![crate_name = "bytes"] #![unstable] -#![feature(alloc, core, io, unsafe_no_drop_flag)] +#![feature(alloc, core, unsafe_no_drop_flag)] pub use byte_buf::{ByteBuf, ROByteBuf, MutByteBuf}; pub use byte_str::{SeqByteStr, SmallByteStr, SmallByteStrBuf}; diff --git a/src/ring.rs b/src/ring.rs index 3d4df0a..89e7940 100644 --- a/src/ring.rs +++ b/src/ring.rs @@ -1,6 +1,5 @@ use super::{Buf, MutBuf}; use std::{cmp, fmt, mem, ptr, slice}; -use std::num::UnsignedInt; use std::rt::heap; /// Buf backed by a continous chunk of memory. Maintains a read cursor and a @@ -27,7 +26,7 @@ impl RingBuf { } // Round to the next power of 2 for better alignment - capacity = UnsignedInt::next_power_of_two(capacity); + capacity = capacity.next_power_of_two(); // Allocate the memory let ptr = unsafe { heap::allocate(capacity, mem::min_align_of::<u8>()) }; diff --git a/test/test_seq_byte_str.rs b/test/test_seq_byte_str.rs index 9b7a2db..d552a03 100644 --- a/test/test_seq_byte_str.rs +++ b/test/test_seq_byte_str.rs @@ -26,7 +26,7 @@ pub fn test_index() { } #[test] -#[should_fail] +#[should_panic] pub fn test_index_out_of_range() { let s = SeqByteStr::from_slice(gen_bytes(2000).as_slice()); let _ = s[2001]; diff --git a/test/test_small_byte_str.rs b/test/test_small_byte_str.rs index cbc920e..2efc95d 100644 --- a/test/test_small_byte_str.rs +++ b/test/test_small_byte_str.rs @@ -26,7 +26,7 @@ pub fn test_index() { } #[test] -#[should_fail] +#[should_panic] pub fn test_index_out_of_range() { let s = SmallByteStr::from_slice(gen_bytes(3).as_slice()).unwrap(); let _ = s[2001]; -- GitLab