diff --git a/actix-cors/src/builder.rs b/actix-cors/src/builder.rs index 08e0895a0..2472cfec1 100644 --- a/actix-cors/src/builder.rs +++ b/actix-cors/src/builder.rs @@ -1,4 +1,4 @@ -use std::{collections::HashSet, convert::TryInto, iter::FromIterator, rc::Rc}; +use std::{collections::HashSet, iter::FromIterator, rc::Rc}; use actix_utils::future::{self, Ready}; use actix_web::{ @@ -610,7 +610,7 @@ where #[cfg(test)] mod test { - use std::convert::{Infallible, TryInto}; + use std::convert::Infallible; use actix_web::{ body, diff --git a/actix-cors/src/lib.rs b/actix-cors/src/lib.rs index e915aad9a..1cb320db4 100644 --- a/actix-cors/src/lib.rs +++ b/actix-cors/src/lib.rs @@ -61,8 +61,8 @@ mod error; mod inner; mod middleware; -use all_or_some::AllOrSome; -pub use builder::Cors; -pub use error::CorsError; -use inner::{Inner, OriginFn}; -pub use middleware::CorsMiddleware; +use crate::{ + all_or_some::AllOrSome, + inner::{Inner, OriginFn}, +}; +pub use crate::{builder::Cors, error::CorsError, middleware::CorsMiddleware}; diff --git a/actix-limitation/src/status.rs b/actix-limitation/src/status.rs index 15fb2d0c9..e7a61e105 100644 --- a/actix-limitation/src/status.rs +++ b/actix-limitation/src/status.rs @@ -1,4 +1,4 @@ -use std::{convert::TryInto, ops::Add, time::Duration}; +use std::{ops::Add, time::Duration}; use chrono::SubsecRound as _; diff --git a/actix-session/src/middleware.rs b/actix-session/src/middleware.rs index 9bab74bf3..5016f6fc7 100644 --- a/actix-session/src/middleware.rs +++ b/actix-session/src/middleware.rs @@ -1,4 +1,4 @@ -use std::{collections::HashMap, convert::TryInto, fmt, future::Future, pin::Pin, rc::Rc}; +use std::{collections::HashMap, fmt, future::Future, pin::Pin, rc::Rc}; use actix_utils::future::{ready, Ready}; use actix_web::{ diff --git a/actix-session/src/storage/cookie.rs b/actix-session/src/storage/cookie.rs index d4144ccce..e74c13cbb 100644 --- a/actix-session/src/storage/cookie.rs +++ b/actix-session/src/storage/cookie.rs @@ -1,5 +1,3 @@ -use std::convert::TryInto; - use actix_web::cookie::time::Duration; use anyhow::Error; diff --git a/actix-session/src/storage/redis_rs.rs b/actix-session/src/storage/redis_rs.rs index 44332f8b4..223e99719 100644 --- a/actix-session/src/storage/redis_rs.rs +++ b/actix-session/src/storage/redis_rs.rs @@ -1,7 +1,7 @@ -use std::{convert::TryInto, sync::Arc}; +use std::sync::Arc; use actix_web::cookie::time::Duration; -use anyhow::{Context, Error}; +use anyhow::Error; use redis::{aio::ConnectionManager, AsyncCommands, Cmd, FromRedisValue, RedisResult, Value}; use super::SessionKey; @@ -226,12 +226,7 @@ impl SessionStore for RedisSessionStore { self.client .clone() - .expire( - &cache_key, - ttl.whole_seconds().try_into().context( - "Failed to convert the state TTL into the number of whole seconds remaining", - )?, - ) + .expire(&cache_key, ttl.whole_seconds()) .await?; Ok(()) } diff --git a/actix-session/src/storage/session_key.rs b/actix-session/src/storage/session_key.rs index ad5c47a1d..cb73a6b22 100644 --- a/actix-session/src/storage/session_key.rs +++ b/actix-session/src/storage/session_key.rs @@ -1,5 +1,3 @@ -use std::convert::TryFrom; - use derive_more::{Display, From}; /// A session key, the string stored in a client-side cookie to associate a user with its session @@ -10,7 +8,6 @@ use derive_more::{Display, From}; /// required to be smaller than 4064 bytes. /// /// ```rust -/// # use std::convert::TryInto; /// use actix_session::storage::SessionKey; /// /// let key: String = std::iter::repeat('a').take(4065).collect(); diff --git a/actix-session/src/storage/utils.rs b/actix-session/src/storage/utils.rs index b50145122..bc9198867 100644 --- a/actix-session/src/storage/utils.rs +++ b/actix-session/src/storage/utils.rs @@ -1,5 +1,3 @@ -use std::convert::TryInto; - use rand::{distributions::Alphanumeric, rngs::OsRng, Rng as _}; use crate::storage::SessionKey; diff --git a/actix-session/tests/opaque_errors.rs b/actix-session/tests/opaque_errors.rs index e896d93cd..55500c494 100644 --- a/actix-session/tests/opaque_errors.rs +++ b/actix-session/tests/opaque_errors.rs @@ -1,4 +1,4 @@ -use std::{collections::HashMap, convert::TryInto}; +use std::collections::HashMap; use actix_session::{ storage::{LoadError, SaveError, SessionKey, SessionStore, UpdateError},