1
0
mirror of https://github.com/actix/actix-extras.git synced 2025-06-30 20:04:26 +02:00

clippy warnings

This commit is contained in:
Nikolay Kim
2018-02-26 14:33:56 -08:00
parent 644f1a9518
commit 72aa2d9eae
33 changed files with 117 additions and 143 deletions

View File

@ -237,7 +237,7 @@ pub(crate) struct WrapperStream<T> where T: AsyncRead + AsyncWrite + 'static {
impl<T> WrapperStream<T> where T: AsyncRead + AsyncWrite + 'static {
pub fn new(io: T) -> Self {
WrapperStream{io: io}
WrapperStream{ io }
}
}

View File

@ -309,7 +309,7 @@ pub(crate) struct EncodedPayload {
impl EncodedPayload {
pub fn new(inner: PayloadSender, enc: ContentEncoding) -> EncodedPayload {
EncodedPayload{ inner: inner, error: false, payload: PayloadStream::new(enc) }
EncodedPayload{ inner, error: false, payload: PayloadStream::new(enc) }
}
}
@ -821,10 +821,7 @@ impl AcceptEncoding {
Err(_) => 0.0,
}
};
Some(AcceptEncoding {
encoding: encoding,
quality: quality,
})
Some(AcceptEncoding{ encoding, quality })
}
/// Parse a raw Accept-Encoding header value into an ordered list.

View File

@ -1,3 +1,5 @@
#![cfg_attr(feature = "cargo-clippy", allow(redundant_field_names))]
use std::{self, io};
use std::rc::Rc;
use std::net::SocketAddr;
@ -62,18 +64,20 @@ struct Entry {
impl<T, H> Http1<T, H>
where T: IoStream, H: HttpHandler + 'static
{
pub fn new(h: Rc<WorkerSettings<H>>, stream: T, addr: Option<SocketAddr>, buf: BytesMut)
-> Self
pub fn new(settings: Rc<WorkerSettings<H>>,
stream: T,
addr: Option<SocketAddr>, read_buf: BytesMut) -> Self
{
let bytes = h.get_shared_bytes();
let bytes = settings.get_shared_bytes();
Http1{ flags: Flags::KEEPALIVE,
settings: h,
addr: addr,
stream: H1Writer::new(stream, bytes),
reader: Reader::new(),
read_buf: buf,
tasks: VecDeque::new(),
keepalive_timer: None }
keepalive_timer: None,
addr,
read_buf,
settings,
}
}
pub fn settings(&self) -> &WorkerSettings<H> {
@ -540,7 +544,7 @@ impl Reader {
let (psender, payload) = Payload::new(false);
let info = PayloadInfo {
tx: PayloadType::new(&msg.get_mut().headers, psender),
decoder: decoder,
decoder,
};
msg.get_mut().payload = Some(payload);
Ok(Async::Ready((HttpRequest::from_message(msg), Some(info))))

View File

@ -1,3 +1,5 @@
#![cfg_attr(feature = "cargo-clippy", allow(redundant_field_names))]
use std::{io, mem};
use bytes::BufMut;
use futures::{Async, Poll};
@ -39,11 +41,11 @@ impl<T: AsyncWrite> H1Writer<T> {
pub fn new(stream: T, buf: SharedBytes) -> H1Writer<T> {
H1Writer {
flags: Flags::empty(),
stream: stream,
encoder: ContentEncoder::empty(buf.clone()),
written: 0,
headers_size: 0,
buffer: buf,
stream,
}
}

View File

@ -1,3 +1,5 @@
#![cfg_attr(feature = "cargo-clippy", allow(redundant_field_names))]
use std::{io, cmp, mem};
use std::rc::Rc;
use std::io::{Read, Write};
@ -53,15 +55,17 @@ impl<T, H> Http2<T, H>
where T: AsyncRead + AsyncWrite + 'static,
H: HttpHandler + 'static
{
pub fn new(h: Rc<WorkerSettings<H>>, io: T, addr: Option<SocketAddr>, buf: Bytes) -> Self
pub fn new(settings: Rc<WorkerSettings<H>>,
io: T,
addr: Option<SocketAddr>, buf: Bytes) -> Self
{
Http2{ flags: Flags::empty(),
settings: h,
addr: addr,
tasks: VecDeque::new(),
state: State::Handshake(
server::handshake(IoWrapper{unread: Some(buf), inner: io})),
keepalive_timer: None,
addr,
settings,
}
}
@ -286,10 +290,10 @@ impl Entry {
Entry {task: task.unwrap_or_else(|| Pipeline::error(HTTPNotFound)),
payload: psender,
recv: recv,
stream: H2Writer::new(resp, settings.get_shared_bytes()),
flags: EntryFlags::empty(),
capacity: 0,
recv,
}
}

View File

@ -1,3 +1,5 @@
#![cfg_attr(feature = "cargo-clippy", allow(redundant_field_names))]
use std::{io, cmp};
use bytes::{Bytes, BytesMut};
use futures::{Async, Poll};
@ -38,7 +40,7 @@ impl H2Writer {
pub fn new(respond: SendResponse<Bytes>, buf: SharedBytes) -> H2Writer {
H2Writer {
respond: respond,
respond,
stream: None,
encoder: ContentEncoder::empty(buf.clone()),
flags: Flags::empty(),

View File

@ -36,11 +36,7 @@ impl ServerSettings {
} else {
"localhost".to_owned()
};
ServerSettings {
addr: addr,
secure: secure,
host: host,
}
ServerSettings { addr, secure, host }
}
/// Returns the socket address of the local half of this TCP connection

View File

@ -62,7 +62,7 @@ impl<H: HttpHandler + 'static> Worker<H> {
Worker {
settings: Rc::new(WorkerSettings::new(h, keep_alive)),
hnd: Arbiter::handle().clone(),
handler: handler,
handler,
}
}