1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-26 15:07:42 +02:00

fix CI clippy warnings (#1664)

This commit is contained in:
Rob Ede
2020-09-10 14:46:35 +01:00
committed by GitHub
parent 2f6e9738c4
commit 7787638f26
11 changed files with 37 additions and 31 deletions

View File

@ -1,5 +1,6 @@
//! Multipart form support for Actix web.
#![deny(rust_2018_idioms)]
#![allow(clippy::borrow_interior_mutable_const)]
mod error;

View File

@ -1,4 +1,5 @@
//! Multipart payload support
use std::cell::{Cell, RefCell, RefMut};
use std::convert::TryFrom;
use std::marker::PhantomData;
@ -108,7 +109,7 @@ impl Stream for Multipart {
fn poll_next(
mut self: Pin<&mut Self>,
cx: &mut Context,
cx: &mut Context<'_>,
) -> Poll<Option<Self::Item>> {
if let Some(err) = self.error.take() {
Poll::Ready(Some(Err(err)))
@ -244,7 +245,7 @@ impl InnerMultipart {
fn poll(
&mut self,
safety: &Safety,
cx: &mut Context,
cx: &mut Context<'_>,
) -> Poll<Option<Result<Field, MultipartError>>> {
if self.state == InnerState::Eof {
Poll::Ready(None)
@ -416,7 +417,10 @@ impl Field {
impl Stream for Field {
type Item = Result<Bytes, MultipartError>;
fn poll_next(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Option<Self::Item>> {
fn poll_next(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Option<Self::Item>> {
if self.safety.current() {
let mut inner = self.inner.borrow_mut();
if let Some(mut payload) =
@ -434,7 +438,7 @@ impl Stream for Field {
}
impl fmt::Debug for Field {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
writeln!(f, "\nField: {}", self.ct)?;
writeln!(f, " boundary: {}", self.inner.borrow().boundary)?;
writeln!(f, " headers:")?;
@ -689,7 +693,7 @@ impl Safety {
self.clean.get()
}
fn clone(&self, cx: &mut Context) -> Safety {
fn clone(&self, cx: &mut Context<'_>) -> Safety {
let payload = Rc::clone(&self.payload);
let s = Safety {
task: LocalWaker::new(),
@ -734,7 +738,7 @@ impl PayloadBuffer {
}
}
fn poll_stream(&mut self, cx: &mut Context) -> Result<(), PayloadError> {
fn poll_stream(&mut self, cx: &mut Context<'_>) -> Result<(), PayloadError> {
loop {
match Pin::new(&mut self.stream).poll_next(cx) {
Poll::Ready(Some(Ok(data))) => self.buf.extend_from_slice(&data),
@ -887,7 +891,7 @@ mod tests {
fn poll_next(
self: Pin<&mut Self>,
cx: &mut Context,
cx: &mut Context<'_>,
) -> Poll<Option<Self::Item>> {
let this = self.get_mut();
if !this.ready {