Use new 2021 edition functionality.

* Remove `TryInto` and `TryFrom` imports.
  * Replace `IntoIter::new()` with `.into_iter()`.
This commit is contained in:
Konrad Borowski 2022-04-19 23:54:33 +02:00 committed by Sergio Benitez
parent 4d258739f5
commit 7bbe0457a5
10 changed files with 3 additions and 19 deletions

View File

@ -1,8 +1,5 @@
//! Extension traits implemented by several HTTP types. //! Extension traits implemented by several HTTP types.
// Temporarily allow `IntoIter::into_iter()` before Rust 2021 transition.
#![allow(deprecated)]
use smallvec::{Array, SmallVec}; use smallvec::{Array, SmallVec};
use state::Storage; use state::Storage;
@ -66,14 +63,14 @@ impl<T: Clone> IntoCollection<T> for &[T] {
impl<T, const N: usize> IntoCollection<T> for [T; N] { impl<T, const N: usize> IntoCollection<T> for [T; N] {
#[inline(always)] #[inline(always)]
fn into_collection<A: Array<Item=T>>(self) -> SmallVec<A> { fn into_collection<A: Array<Item=T>>(self) -> SmallVec<A> {
std::array::IntoIter::new(self).collect() self.into_iter().collect()
} }
#[inline] #[inline]
fn mapped<U, F, A: Array<Item=U>>(self, f: F) -> SmallVec<A> fn mapped<U, F, A: Array<Item=U>>(self, f: F) -> SmallVec<A>
where F: FnMut(T) -> U where F: FnMut(T) -> U
{ {
std::array::IntoIter::new(self).map(f).collect() self.into_iter().map(f).collect()
} }
} }

View File

@ -1,5 +1,4 @@
use std::fmt::{self, Display}; use std::fmt::{self, Display};
use std::convert::TryFrom;
use std::borrow::Cow; use std::borrow::Cow;
use crate::ext::IntoOwned; use crate::ext::IntoOwned;

View File

@ -79,7 +79,6 @@
//! ``` //! ```
use std::borrow::Cow; use std::borrow::Cow;
use std::convert::TryInto;
use std::ops::{RangeBounds, Bound}; use std::ops::{RangeBounds, Bound};
use std::fmt::Debug; use std::fmt::Debug;

View File

@ -1,5 +1,4 @@
use std::fmt; use std::fmt;
use std::convert::TryInto;
use parking_lot::RwLock; use parking_lot::RwLock;

View File

@ -1,5 +1,4 @@
use std::fmt; use std::fmt;
use std::convert::TryInto;
use crate::{Request, Data}; use crate::{Request, Data};
use crate::http::{Status, Method}; use crate::http::{Status, Method};

View File

@ -1,6 +1,5 @@
use std::fmt; use std::fmt;
use std::cell::RefCell; use std::cell::RefCell;
use std::convert::TryInto;
use crate::{Rocket, Phase, Orbit, Error}; use crate::{Rocket, Phase, Orbit, Error};
use crate::local::{asynchronous, blocking::{LocalRequest, LocalResponse}}; use crate::local::{asynchronous, blocking::{LocalRequest, LocalResponse}};

View File

@ -1,5 +1,4 @@
use std::fmt; use std::fmt;
use std::convert::TryInto;
use crate::{Request, http::Method, local::asynchronous}; use crate::{Request, http::Method, local::asynchronous};
use crate::http::uri::Origin; use crate::http::uri::Origin;

View File

@ -1,5 +1,3 @@
use std::convert::TryInto;
use crate::request::Request; use crate::request::Request;
use crate::response::{self, Response, Responder}; use crate::response::{self, Response, Responder};
use crate::http::uri::Reference; use crate::http::uri::Reference;

View File

@ -1,7 +1,3 @@
// Temporarily allow `IntoIter::into_iter()` before Rust 2021 transition.
#![allow(deprecated)]
use std::array;
use std::borrow::Cow; use std::borrow::Cow;
use tokio::io::AsyncRead; use tokio::io::AsyncRead;
@ -340,7 +336,7 @@ impl Event {
Some(RawLinedEvent::raw("")), Some(RawLinedEvent::raw("")),
]; ];
stream::iter(array::IntoIter::new(events)).filter_map(ready) stream::iter(events).filter_map(ready)
} }
} }

View File

@ -1,6 +1,5 @@
use std::fmt; use std::fmt;
use std::ops::{Deref, DerefMut}; use std::ops::{Deref, DerefMut};
use std::convert::TryInto;
use std::net::SocketAddr; use std::net::SocketAddr;
use yansi::Paint; use yansi::Paint;