Format with rustfmt (#389)

* Format with rustfmt

* Add rustfmt check to CI
This commit is contained in:
Taiki Endo
2020-05-22 13:17:30 +09:00
committed by GitHub
parent 5e93fa4c6b
commit 1fbf83816b
27 changed files with 410 additions and 331 deletions
+2 -2
View File
@@ -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() {
+5 -7
View File
@@ -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""[..]);
+5 -1
View File
@@ -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) {
+1 -1
View File
@@ -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;
-1
View File
@@ -11,7 +11,6 @@ fn iter_len() {
assert_eq!(iter.len(), 11);
}
#[test]
fn empty_iter_len() {
let buf = Bytes::from_static(b"");
+1 -1
View File
@@ -3,7 +3,7 @@
use std::io::{BufRead, Read};
use bytes::buf::{BufExt};
use bytes::buf::BufExt;
#[test]
fn read() {
+1 -1
View File
@@ -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() {