Skip to content
Snippets Groups Projects
Commit 3f9b7f6d authored by Florian Hartwig's avatar Florian Hartwig
Browse files

Fix errors and warnings with current rust nightly

parent e806a59b
No related branches found
No related tags found
No related merge requests found
use {alloc, Bytes, SeqByteStr, MAX_CAPACITY}; use {alloc, Bytes, SeqByteStr, MAX_CAPACITY};
use traits::{Buf, MutBuf, MutBufExt, ByteStr}; use traits::{Buf, MutBuf, MutBufExt, ByteStr};
use std::{cmp, ptr}; use std::{cmp, ptr};
use std::num::UnsignedInt;
/* /*
* *
...@@ -57,7 +56,7 @@ impl ByteBuf { ...@@ -57,7 +56,7 @@ impl ByteBuf {
} }
// Round the capacity to the closest power of 2 // 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 // Allocate the memory
let mem = alloc::HEAP.allocate(capacity as usize); let mem = alloc::HEAP.allocate(capacity as usize);
......
#![crate_name = "bytes"] #![crate_name = "bytes"]
#![unstable] #![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_buf::{ByteBuf, ROByteBuf, MutByteBuf};
pub use byte_str::{SeqByteStr, SmallByteStr, SmallByteStrBuf}; pub use byte_str::{SeqByteStr, SmallByteStr, SmallByteStrBuf};
......
use super::{Buf, MutBuf}; use super::{Buf, MutBuf};
use std::{cmp, fmt, mem, ptr, slice}; use std::{cmp, fmt, mem, ptr, slice};
use std::num::UnsignedInt;
use std::rt::heap; use std::rt::heap;
/// Buf backed by a continous chunk of memory. Maintains a read cursor and a /// Buf backed by a continous chunk of memory. Maintains a read cursor and a
...@@ -27,7 +26,7 @@ impl RingBuf { ...@@ -27,7 +26,7 @@ impl RingBuf {
} }
// Round to the next power of 2 for better alignment // 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 // Allocate the memory
let ptr = unsafe { heap::allocate(capacity, mem::min_align_of::<u8>()) }; let ptr = unsafe { heap::allocate(capacity, mem::min_align_of::<u8>()) };
......
...@@ -26,7 +26,7 @@ pub fn test_index() { ...@@ -26,7 +26,7 @@ pub fn test_index() {
} }
#[test] #[test]
#[should_fail] #[should_panic]
pub fn test_index_out_of_range() { pub fn test_index_out_of_range() {
let s = SeqByteStr::from_slice(gen_bytes(2000).as_slice()); let s = SeqByteStr::from_slice(gen_bytes(2000).as_slice());
let _ = s[2001]; let _ = s[2001];
......
...@@ -26,7 +26,7 @@ pub fn test_index() { ...@@ -26,7 +26,7 @@ pub fn test_index() {
} }
#[test] #[test]
#[should_fail] #[should_panic]
pub fn test_index_out_of_range() { pub fn test_index_out_of_range() {
let s = SmallByteStr::from_slice(gen_bytes(3).as_slice()).unwrap(); let s = SmallByteStr::from_slice(gen_bytes(3).as_slice()).unwrap();
let _ = s[2001]; let _ = s[2001];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment