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

0 commit comments

Comments
 (0)