Skip to content

Commit 5605178

Browse files
committed
standardize future types to ones from actix_utils
1 parent ec66754 commit 5605178

File tree

19 files changed

+53
-42
lines changed

19 files changed

+53
-42
lines changed

actix-cors/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ name = "actix_cors"
1717
path = "src/lib.rs"
1818

1919
[dependencies]
20-
actix-web = { version = "4.0.0-beta.10", default-features = false }
2120
actix-service = "2.0.0"
21+
actix-utils = "3"
22+
actix-web = { version = "4.0.0-beta.10", default-features = false }
2223

2324
derive_more = "0.99.5"
2425
futures-util = { version = "0.3.7", default-features = false }
@@ -28,5 +29,5 @@ smallvec = "1.6"
2829

2930
[dev-dependencies]
3031
actix-rt = "2"
31-
pretty_env_logger = "0.4"
32+
env_logger = "0.9"
3233
regex = "1.4"

actix-cors/examples/cors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use actix_web::{http::header, web, App, HttpServer};
33

44
#[actix_web::main]
55
async fn main() -> std::io::Result<()> {
6-
pretty_env_logger::init();
6+
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
77

88
HttpServer::new(move || {
99
App::new()

actix-cors/src/builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ use std::{
22
collections::HashSet, convert::TryInto, error::Error as StdError, iter::FromIterator, rc::Rc,
33
};
44

5+
use actix_utils::future::{self, Ready};
56
use actix_web::{
67
body::MessageBody,
78
dev::{RequestHead, Service, ServiceRequest, ServiceResponse, Transform},
89
error::{Error, Result},
910
http::{self, header::HeaderName, Error as HttpError, HeaderValue, Method, Uri},
1011
Either,
1112
};
12-
use futures_util::future::{self, Ready};
1313
use log::error;
1414
use once_cell::sync::Lazy;
1515
use smallvec::smallvec;

actix-cors/src/middleware.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use std::{collections::HashSet, convert::TryInto, error::Error as StdError, rc::Rc};
22

3+
use actix_utils::future::{ok, Either, Ready};
34
use actix_web::{
45
body::{AnyBody, MessageBody},
56
dev::{Service, ServiceRequest, ServiceResponse},
@@ -10,7 +11,7 @@ use actix_web::{
1011
},
1112
HttpResponse,
1213
};
13-
use futures_util::future::{ok, Either, FutureExt as _, LocalBoxFuture, Ready, TryFutureExt as _};
14+
use futures_util::future::{FutureExt as _, LocalBoxFuture, TryFutureExt as _};
1415
use log::debug;
1516

1617
use crate::{builder::intersperse_header_values, AllOrSome, Inner};
@@ -155,15 +156,15 @@ where
155156
if self.inner.preflight && req.method() == Method::OPTIONS {
156157
let inner = Rc::clone(&self.inner);
157158
let res = Self::handle_preflight(&inner, req);
158-
Either::Left(ok(res))
159+
Either::left(ok(res))
159160
} else {
160161
let origin = req.headers().get(header::ORIGIN).cloned();
161162

162163
if origin.is_some() {
163164
// Only check requests with a origin header.
164165
if let Err(err) = self.inner.validate_origin(req.head()) {
165166
debug!("origin validation failed; inner service is not called");
166-
return Either::Left(ok(req.error_response(err)));
167+
return Either::left(ok(req.error_response(err)));
167168
}
168169
}
169170

@@ -183,7 +184,7 @@ where
183184
.map_ok(|res| res.map_body(|_, body| AnyBody::new_boxed(body)))
184185
.boxed_local();
185186

186-
Either::Right(res)
187+
Either::right(res)
187188
}
188189
}
189190
}

actix-cors/tests/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use actix_service::fn_service;
2+
use actix_utils::future::ok;
23
use actix_web::{
34
dev::{ServiceRequest, Transform},
45
http::{header, HeaderValue, Method, StatusCode},
56
test::{self, TestRequest},
67
HttpResponse,
78
};
8-
use futures_util::future::ok;
99
use regex::bytes::Regex;
1010

1111
use actix_cors::Cors;

actix-identity/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ authors = ["Nikolay Kim <[email protected]>"]
55
description = "Identity service for Actix web"
66
keywords = ["actix", "auth", "identity", "web", "security"]
77
homepage = "https://actix.rs"
8-
repository = "https://github.com/actix/actix-extras"
8+
repository = "https://github.com/actix/actix-extras.git"
99
license = "MIT OR Apache-2.0"
1010
edition = "2018"
1111

@@ -15,6 +15,7 @@ path = "src/lib.rs"
1515

1616
[dependencies]
1717
actix-service = "2.0.0"
18+
actix-utils = "3"
1819
actix-web = { version = "4.0.0-beta.10", default-features = false, features = ["cookies", "secure-cookies"] }
1920
futures-util = { version = "0.3.7", default-features = false }
2021
serde = "1.0"

actix-identity/src/cookie.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::{rc::Rc, time::SystemTime};
22

3-
use futures_util::future::{ready, Ready};
3+
use actix_utils::future::{ready, Ready};
44
use serde::{Deserialize, Serialize};
55
use time::Duration;
66

actix-identity/src/identity.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use actix_web::{
22
dev::{Extensions, Payload},
33
Error, FromRequest, HttpRequest,
44
};
5-
use futures_util::future::{ready, Ready};
5+
use actix_utils::future::{ready, Ready};
66

77
pub(crate) struct IdentityItem {
88
pub(crate) id: Option<String>,

actix-identity/src/middleware.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
use std::{error::Error as StdError, rc::Rc};
22

3+
use actix_utils::future::{ready, Ready};
34
use actix_web::{
45
body::{AnyBody, MessageBody},
56
dev::{Service, ServiceRequest, ServiceResponse, Transform},
67
Error, HttpMessage, Result,
78
};
8-
use futures_util::future::{ready, FutureExt as _, LocalBoxFuture, Ready, TryFutureExt as _};
9+
use futures_util::future::{FutureExt as _, LocalBoxFuture, TryFutureExt as _};
910

1011
use crate::{identity::IdentityItem, IdentityPolicy};
1112

@@ -129,7 +130,8 @@ mod tests {
129130

130131
#[actix_rt::test]
131132
async fn test_borrowed_mut_error() {
132-
use futures_util::future::{lazy, ok, Ready};
133+
use actix_utils::future::{ok, Ready};
134+
use futures_util::future::lazy;
133135

134136
struct Ident;
135137
impl IdentityPolicy for Ident {

actix-protobuf/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ authors = [
99
description = "Protobuf support for Actix web"
1010
keywords = ["actix", "protobuf", "protocol", "rpc"]
1111
homepage = "https://actix.rs"
12-
repository = "https://github.com/actix/actix-extras"
12+
repository = "https://github.com/actix/actix-extras.git"
1313
license = "MIT OR Apache-2.0"
1414
exclude = [".cargo/config", "/examples/**"]
1515

actix-redis/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ description = "Redis integration for Actix and session store for Actix Web"
66
license = "MIT OR Apache-2.0"
77
keywords = ["actix", "redis", "async", "session"]
88
homepage = "https://actix.rs"
9-
repository = "https://github.com/actix/actix-extras"
9+
repository = "https://github.com/actix/actix-extras.git"
1010
categories = ["network-programming", "asynchronous"]
1111
exclude = [".cargo/config"]
1212
edition = "2018"

actix-session/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ authors = ["Nikolay Kim <[email protected]>"]
55
description = "Sessions for Actix web"
66
keywords = ["http", "web", "framework", "async", "session"]
77
homepage = "https://actix.rs"
8-
repository = "https://github.com/actix/actix-extras"
8+
repository = "https://github.com/actix/actix-extras.git"
99
license = "MIT OR Apache-2.0"
1010
edition = "2018"
1111

@@ -18,8 +18,9 @@ default = ["cookie-session"]
1818
cookie-session = ["actix-web/secure-cookies"]
1919

2020
[dependencies]
21-
actix-web = { version = "4.0.0-beta.10", default_features = false, features = ["cookies"] }
2221
actix-service = "2.0.0"
22+
actix-utils = "3"
23+
actix-web = { version = "4.0.0-beta.10", default_features = false, features = ["cookies"] }
2324

2425
derive_more = "0.99.5"
2526
futures-util = { version = "0.3.7", default-features = false }

actix-session/src/cookie.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
33
use std::{collections::HashMap, error::Error as StdError, rc::Rc};
44

5+
use actix_utils::future::{ok, Ready};
56
use actix_web::{
67
body::{AnyBody, MessageBody},
78
cookie::{Cookie, CookieJar, Key, SameSite},
@@ -10,7 +11,7 @@ use actix_web::{
1011
Error, ResponseError,
1112
};
1213
use derive_more::Display;
13-
use futures_util::future::{ok, FutureExt as _, LocalBoxFuture, Ready};
14+
use futures_util::future::{FutureExt as _, LocalBoxFuture};
1415
use serde_json::error::Error as JsonError;
1516
use time::{Duration, OffsetDateTime};
1617

actix-session/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ use std::{
4949
rc::Rc,
5050
};
5151

52+
use actix_utils::future::{ok, Ready};
5253
use actix_web::{
5354
dev::{Extensions, Payload, RequestHead, ServiceRequest, ServiceResponse},
5455
Error, FromRequest, HttpMessage, HttpRequest,
5556
};
56-
use futures_util::future::{ok, Ready};
5757
use serde::{de::DeserializeOwned, Serialize};
5858

5959
#[cfg(feature = "cookie-session")]

actix-web-httpauth/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,13 @@ name = "actix_web_httpauth"
1818
path = "src/lib.rs"
1919

2020
[dependencies]
21-
actix-web = { version = "4.0.0-beta.10", default_features = false }
2221
actix-service = "2.0.0"
22+
actix-utils = "3"
23+
actix-web = { version = "4.0.0-beta.10", default_features = false }
24+
2325
base64 = "0.13"
2426
futures-util = { version = "0.3.7", default-features = false }
27+
futures-core = { version = "0.3.7", default-features = false }
2528
pin-project-lite = "0.2.7"
2629

2730
[dev-dependencies]

actix-web-httpauth/src/extractors/basic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
33
use std::borrow::Cow;
44

5+
use actix_utils::future::{ready, Ready};
56
use actix_web::dev::{Payload, ServiceRequest};
67
use actix_web::http::header::Header;
78
use actix_web::{FromRequest, HttpRequest};
8-
use futures_util::future::{ready, Ready};
99

1010
use super::config::AuthExtractorConfig;
1111
use super::errors::AuthenticationError;

actix-web-httpauth/src/extractors/bearer.rs

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
//! Extractor for the "Bearer" HTTP Authentication Scheme
22
3-
use std::borrow::Cow;
4-
use std::default::Default;
5-
6-
use actix_web::dev::{Payload, ServiceRequest};
7-
use actix_web::http::header::Header;
8-
use actix_web::{FromRequest, HttpRequest};
9-
use futures_util::future::{ready, Ready};
10-
11-
use super::config::AuthExtractorConfig;
12-
use super::errors::AuthenticationError;
13-
use super::AuthExtractor;
14-
use crate::headers::authorization;
15-
use crate::headers::www_authenticate::bearer;
3+
use std::{borrow::Cow, default::Default};
4+
5+
use actix_utils::future::{ready, Ready};
6+
use actix_web::{
7+
dev::{Payload, ServiceRequest},
8+
http::header::Header,
9+
FromRequest, HttpRequest,
10+
};
11+
12+
use super::{config::AuthExtractorConfig, errors::AuthenticationError, AuthExtractor};
1613
pub use crate::headers::www_authenticate::bearer::Error;
14+
use crate::headers::{authorization, www_authenticate::bearer};
1715

1816
/// [BearerAuth](./struct/BearerAuth.html) extractor configuration.
1917
#[derive(Debug, Clone, Default)]

actix-web-httpauth/src/extractors/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use std::{
88

99
use actix_web::dev::ServiceRequest;
1010
use actix_web::Error;
11-
use futures_util::ready;
11+
use futures_core::ready;
1212
use pin_project_lite::pin_project;
1313

1414
pub mod basic;

actix-web-httpauth/src/middleware.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
//! HTTP Authentication middleware.
22
33
use std::{
4-
error::Error as StdError, future::Future, marker::PhantomData, pin::Pin, rc::Rc, sync::Arc,
4+
error::Error as StdError,
5+
future::Future,
6+
marker::PhantomData,
7+
pin::Pin,
8+
rc::Rc,
9+
sync::Arc,
10+
task::{Context, Poll},
511
};
612

713
use actix_web::{
814
body::{AnyBody, MessageBody},
915
dev::{Service, ServiceRequest, ServiceResponse, Transform},
1016
Error,
1117
};
12-
use futures_util::{
13-
future::{self, FutureExt as _, LocalBoxFuture, TryFutureExt as _},
14-
ready,
15-
task::{Context, Poll},
16-
};
18+
use futures_core::ready;
19+
use futures_util::future::{self, FutureExt as _, LocalBoxFuture, TryFutureExt as _};
1720

1821
use crate::extractors::{basic, bearer, AuthExtractor};
1922

0 commit comments

Comments
 (0)