chore: remove redundant field names in struct literals (#1334)

This commit is contained in:
Taiki Endo
2019-07-20 10:43:19 -07:00
committed by Carl Lerche
parent 1b2d997863
commit 9af07ce208
26 changed files with 33 additions and 43 deletions
+2 -2
View File
@@ -144,8 +144,8 @@ impl<T, U> Framed<T, U> {
FramedParts {
io: inner.0,
codec: inner.1,
read_buf: read_buf,
write_buf: write_buf,
read_buf,
write_buf,
_priv: (),
}
}
+2 -2
View File
@@ -138,7 +138,7 @@ where
pub fn framed_read2<T>(inner: T) -> FramedRead2<T> {
FramedRead2 {
inner: inner,
inner,
eof: false,
is_readable: false,
buffer: BytesMut::with_capacity(INITIAL_CAPACITY),
@@ -151,7 +151,7 @@ pub fn framed_read2_with_buffer<T>(inner: T, mut buf: BytesMut) -> FramedRead2<T
buf.reserve(bytes_to_reserve);
}
FramedRead2 {
inner: inner,
inner,
eof: false,
is_readable: buf.len() > 0,
buffer: buf,
+2 -5
View File
@@ -138,7 +138,7 @@ where
pub fn framed_write2<T>(inner: T) -> FramedWrite2<T> {
FramedWrite2 {
inner: inner,
inner,
buffer: BytesMut::with_capacity(INITIAL_CAPACITY),
}
}
@@ -148,10 +148,7 @@ pub fn framed_write2_with_buffer<T>(inner: T, mut buf: BytesMut) -> FramedWrite2
let bytes_to_reserve = INITIAL_CAPACITY - buf.capacity();
buf.reserve(bytes_to_reserve);
}
FramedWrite2 {
inner: inner,
buffer: buf,
}
FramedWrite2 { inner, buffer: buf }
}
impl<T> FramedWrite2<T> {
+2 -2
View File
@@ -268,7 +268,7 @@ impl<P: Park> CurrentThread<P> {
let num_futures = Arc::new(atomic::AtomicUsize::new(0));
CurrentThread {
scheduler: scheduler,
scheduler,
num_futures: num_futures.clone(),
park,
id,
@@ -279,7 +279,7 @@ impl<P: Park> CurrentThread<P> {
thread,
id,
},
spawn_receiver: spawn_receiver,
spawn_receiver,
}
}
+2 -2
View File
@@ -147,11 +147,11 @@ where
tick_num: AtomicUsize::new(0),
head_readiness: AtomicPtr::new(stub_ptr as *mut _),
tail_readiness: UnsafeCell::new(stub_ptr),
stub: stub,
stub,
});
Scheduler {
inner: inner,
inner,
nodes: List::new(),
}
}
+1 -1
View File
@@ -30,7 +30,7 @@ where
P: AsRef<Path>,
{
fn new(path: P) -> CreateDirFuture<P> {
CreateDirFuture { path: path }
CreateDirFuture { path }
}
}
+1 -1
View File
@@ -31,7 +31,7 @@ where
P: AsRef<Path>,
{
fn new(path: P) -> CreateDirAllFuture<P> {
CreateDirAllFuture { path: path }
CreateDirAllFuture { path }
}
}
+1 -1
View File
@@ -36,7 +36,7 @@ where
Q: AsRef<Path>,
{
fn new(src: P, dst: Q) -> HardLinkFuture<P, Q> {
HardLinkFuture { src: src, dst: dst }
HardLinkFuture { src, dst }
}
}
+1 -1
View File
@@ -36,7 +36,7 @@ where
Q: AsRef<Path>,
{
fn new(src: P, dst: Q) -> SymlinkFuture<P, Q> {
SymlinkFuture { src: src, dst: dst }
SymlinkFuture { src, dst }
}
}
+1 -1
View File
@@ -35,7 +35,7 @@ where
Q: AsRef<Path>,
{
fn new(src: P, dst: Q) -> SymlinkDirFuture<P, Q> {
SymlinkDirFuture { src: src, dst: dst }
SymlinkDirFuture { src, dst }
}
}
+1 -1
View File
@@ -35,7 +35,7 @@ where
Q: AsRef<Path>,
{
fn new(src: P, dst: Q) -> SymlinkFileFuture<P, Q> {
SymlinkFileFuture { src: src, dst: dst }
SymlinkFileFuture { src, dst }
}
}
+1 -1
View File
@@ -37,7 +37,7 @@ where
P: AsRef<Path> + Send + 'static,
{
fn new(path: P) -> ReadDirFuture<P> {
ReadDirFuture { path: path }
ReadDirFuture { path }
}
}
+1 -1
View File
@@ -30,7 +30,7 @@ where
P: AsRef<Path>,
{
fn new(path: P) -> ReadLinkFuture<P> {
ReadLinkFuture { path: path }
ReadLinkFuture { path }
}
}
+1 -1
View File
@@ -30,7 +30,7 @@ where
P: AsRef<Path>,
{
fn new(path: P) -> RemoveDirFuture<P> {
RemoveDirFuture { path: path }
RemoveDirFuture { path }
}
}
+1 -1
View File
@@ -34,7 +34,7 @@ where
P: AsRef<Path>,
{
fn new(path: P) -> RemoveFileFuture<P> {
RemoveFileFuture { path: path }
RemoveFileFuture { path }
}
}
+1 -1
View File
@@ -36,7 +36,7 @@ where
Q: AsRef<Path>,
{
fn new(from: P, to: Q) -> RenameFuture<P, Q> {
RenameFuture { from: from, to: to }
RenameFuture { from, to }
}
}
+1 -4
View File
@@ -31,10 +31,7 @@ where
P: AsRef<Path>,
{
fn new(path: P, perm: fs::Permissions) -> SetPermissionsFuture<P> {
SetPermissionsFuture {
path: path,
perm: perm,
}
SetPermissionsFuture { path, perm }
}
}
+1 -1
View File
@@ -224,7 +224,7 @@ impl Reactor {
events: mio::Events::with_capacity(1024),
_wakeup_registration: wakeup_pair.0,
inner: Arc::new(Inner {
io: io,
io,
next_aba_guard: AtomicUsize::new(0),
io_dispatch: RwLock::new(Slab::with_capacity(1)),
wakeup: wakeup_pair.1,
+2 -6
View File
@@ -195,7 +195,7 @@ impl Driver {
let stream = globals().receiver.try_clone()?;
let wakeup = PollEvented::new_with_handle(stream, handle)?;
Ok(Driver { wakeup: wakeup })
Ok(Driver { wakeup })
}
/// Drain all data in the global receiver, ensuring we'll get woken up when
@@ -321,11 +321,7 @@ impl Signal {
let (tx, rx) = channel(1);
globals().register_listener(signal as EventId, tx);
Ok(Signal {
driver: driver,
rx: rx,
signal: signal,
})
Ok(Signal { driver, rx, signal })
})
.boxed()
}
+1 -1
View File
@@ -304,7 +304,7 @@ impl<T> Clone for Receiver<T> {
let ver = self.ver;
Receiver {
shared: shared,
shared,
inner,
id,
ver,
+1 -1
View File
@@ -154,7 +154,7 @@ impl TcpStream {
Err(e) => Error(e),
};
ConnectFuture { inner: inner }
ConnectFuture { inner }
}
/// Check the TCP stream's read readiness state.
+1 -1
View File
@@ -100,7 +100,7 @@ impl Blocking {
Blocking {
state: AtomicUsize::new(init.into()),
tail: UnsafeCell::new(ptr),
stub: stub,
stub,
lock: AtomicUsize::new(0),
}
}
+1 -1
View File
@@ -27,7 +27,7 @@ impl<T> Throttle<T> {
Self {
delay: Delay::new_timeout(clock::now() + duration, duration),
has_delayed: true,
stream: stream,
stream,
}
}
}
+1 -1
View File
@@ -24,7 +24,7 @@ impl UdpSocket {
fn new(socket: mio::net::UdpSocket) -> UdpSocket {
let io = PollEvented::new(socket);
UdpSocket { io: io }
UdpSocket { io }
}
/// Creates a new `UdpSocket` from the previously bound socket provided.
+2 -2
View File
@@ -215,7 +215,7 @@ mod transfer {
.and_then(|sock| {
sock.set_linger(Some(Duration::from_secs(0))).unwrap();
let drain = Drain {
sock: sock,
sock,
chunk: read_size,
};
drain
@@ -226,7 +226,7 @@ mod transfer {
let client = TcpStream::connect(&addr)
.and_then(move |sock| Transfer {
sock: sock,
sock,
rem: MB,
chunk: write_size,
})
+1 -1
View File
@@ -58,7 +58,7 @@ async fn main() {
println!("Listening on: {}", socket.local_addr().unwrap());
let server = Server {
socket: socket,
socket,
buf: vec![0; 1024],
to_send: None,
};