aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_buf_mut.rs4
-rw-r--r--tests/test_bytes.rs12
-rw-r--r--tests/test_bytes_vec_alloc.rs6
-rw-r--r--tests/test_chain.rs2
-rw-r--r--tests/test_iter.rs1
-rw-r--r--tests/test_reader.rs2
-rw-r--r--tests/test_serde.rs2
7 files changed, 15 insertions, 14 deletions
diff --git a/tests/test_buf_mut.rs b/tests/test_buf_mut.rs
index d2f9b8e..c70e209 100644
--- a/tests/test_buf_mut.rs
+++ b/tests/test_buf_mut.rs
@@ -1,10 +1,10 @@
#![deny(warnings, rust_2018_idioms)]
-use bytes::{BufMut, BytesMut};
#[cfg(feature = "std")]
use bytes::buf::IoSliceMut;
-use core::usize;
+use bytes::{BufMut, BytesMut};
use core::fmt::Write;
+use core::usize;
#[test]
fn test_vec_as_mut_buf() {
diff --git a/tests/test_bytes.rs b/tests/test_bytes.rs
index 4775773..106fa6f 100644
--- a/tests/test_bytes.rs
+++ b/tests/test_bytes.rs
@@ -1,6 +1,6 @@
#![deny(warnings, rust_2018_idioms)]
-use bytes::{Bytes, BytesMut, Buf, BufMut};
+use bytes::{Buf, BufMut, Bytes, BytesMut};
use std::usize;
@@ -44,7 +44,6 @@ fn test_layout() {
mem::size_of::<Option<BytesMut>>(),
"BytesMut should be same size as Option<BytesMut>",
);
-
}
#[test]
@@ -87,13 +86,11 @@ fn fmt_write() {
write!(a, "{}", &s[..64]).unwrap();
assert_eq!(a, s[..64].as_bytes());
-
let mut b = BytesMut::with_capacity(64);
write!(b, "{}", &s[..32]).unwrap();
write!(b, "{}", &s[32..64]).unwrap();
assert_eq!(b, s[..64].as_bytes());
-
let mut c = BytesMut::with_capacity(64);
write!(c, "{}", s).unwrap();
assert_eq!(c, s[..].as_bytes());
@@ -305,11 +302,13 @@ fn split_off_to_at_gt_len() {
assert!(panic::catch_unwind(move || {
let _ = make_bytes().split_to(5);
- }).is_err());
+ })
+ .is_err());
assert!(panic::catch_unwind(move || {
let _ = make_bytes().split_off(5);
- }).is_err());
+ })
+ .is_err());
}
#[test]
@@ -864,7 +863,6 @@ fn slice_ref_works() {
test_slice_ref(&bytes, 9, 9, b"");
}
-
#[test]
fn slice_ref_empty() {
let bytes = Bytes::from(&b""[..]);
diff --git a/tests/test_bytes_vec_alloc.rs b/tests/test_bytes_vec_alloc.rs
index dc007cf..418a9cd 100644
--- a/tests/test_bytes_vec_alloc.rs
+++ b/tests/test_bytes_vec_alloc.rs
@@ -39,7 +39,11 @@ unsafe impl GlobalAlloc for Ledger {
let off_ptr = (ptr as *mut usize).offset(-1);
let orig_size = off_ptr.read();
if orig_size != layout.size() {
- panic!("bad dealloc: alloc size was {}, dealloc size is {}", orig_size, layout.size());
+ panic!(
+ "bad dealloc: alloc size was {}, dealloc size is {}",
+ orig_size,
+ layout.size()
+ );
}
let new_layout = match Layout::from_size_align(layout.size() + USIZE_SIZE, 1) {
diff --git a/tests/test_chain.rs b/tests/test_chain.rs
index df354bf..82de7fc 100644
--- a/tests/test_chain.rs
+++ b/tests/test_chain.rs
@@ -1,7 +1,7 @@
#![deny(warnings, rust_2018_idioms)]
-use bytes::{Buf, BufMut, Bytes};
use bytes::buf::{BufExt, BufMutExt};
+use bytes::{Buf, BufMut, Bytes};
#[cfg(feature = "std")]
use std::io::IoSlice;
diff --git a/tests/test_iter.rs b/tests/test_iter.rs
index 13b86cd..2302a69 100644
--- a/tests/test_iter.rs
+++ b/tests/test_iter.rs
@@ -11,7 +11,6 @@ fn iter_len() {
assert_eq!(iter.len(), 11);
}
-
#[test]
fn empty_iter_len() {
let buf = Bytes::from_static(b"");
diff --git a/tests/test_reader.rs b/tests/test_reader.rs
index 608d974..b5da2c9 100644
--- a/tests/test_reader.rs
+++ b/tests/test_reader.rs
@@ -3,7 +3,7 @@
use std::io::{BufRead, Read};
-use bytes::buf::{BufExt};
+use bytes::buf::BufExt;
#[test]
fn read() {
diff --git a/tests/test_serde.rs b/tests/test_serde.rs
index 18b1356..36b87f2 100644
--- a/tests/test_serde.rs
+++ b/tests/test_serde.rs
@@ -1,7 +1,7 @@
#![cfg(feature = "serde")]
#![deny(warnings, rust_2018_idioms)]
-use serde_test::{Token, assert_tokens};
+use serde_test::{assert_tokens, Token};
#[test]
fn test_ser_de_empty() {