Skip to content
This repository has been archived by the owner on Jul 17, 2023. It is now read-only.

Commit

Permalink
rust 1.37.0 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
bomgar committed Sep 12, 2019
1 parent 50a0ef5 commit 9e25496
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
8 changes: 4 additions & 4 deletions src/auth_middleware.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ impl<S> FromRequest<S> for AuthContext {
}
}

static SUBJECT_HEADER_NAME: &'static str = "X-Auth-Sub";
static TOKEN_HEADER_NAME: &'static str = "X-Auth-Token";
static ORGANIZATION_HEADER_NAME: &'static str = "X-Auth-Org";
static SCOPES_HEADER_PREFIX: &'static str = "x-auth-scopes-";
static SUBJECT_HEADER_NAME: &str = "X-Auth-Sub";
static TOKEN_HEADER_NAME: &str = "X-Auth-Token";
static ORGANIZATION_HEADER_NAME: &str = "X-Auth-Org";
static SCOPES_HEADER_PREFIX: &str = "x-auth-scopes-";

pub fn admin_scoped_action<F>(req: &HttpRequest, f: F) -> Result<HttpResponse>
where
Expand Down
2 changes: 1 addition & 1 deletion src/business_result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ where
}
}

pub type AsyncBusinessResult<T> = Box<Future<Item = T, Error = Problem>>;
pub type AsyncBusinessResult<T> = Box<dyn Future<Item = T, Error = Problem>>;

pub fn success<T: 'static>(result: T) -> AsyncBusinessResult<T> {
Box::new(future::ok(result))
Expand Down
6 changes: 3 additions & 3 deletions src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ enum StatusCategory {
impl StatusCategory {
fn from_status(status: StatusCode) -> StatusCategory {
match status.as_u16() {
200...299 => StatusCategory::Ok,
300...399 => StatusCategory::Redirect,
400...499 => StatusCategory::ClientError,
200..=299 => StatusCategory::Ok,
300..=399 => StatusCategory::Redirect,
400..=499 => StatusCategory::ClientError,
_ => StatusCategory::InternalError,
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/service_requester.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub fn encode_url_component<S: AsRef<[u8]>>(value: S) -> String {
#[derive(Clone)]
pub struct ServiceRequester {
token_creator: Addr<gatekeeper::TokenCreator>,
error_handler: &'static (Fn(client::ClientResponse) -> Box<Future<Item = Problem, Error = Problem>> + Sync),
error_handler: &'static (dyn Fn(client::ClientResponse) -> Box<dyn Future<Item = Problem, Error = Problem>> + Sync),
}

pub trait IntoClientRequest {
Expand All @@ -32,7 +32,7 @@ impl ServiceRequester {

pub fn with_error_handler(
&self,
error_handler: &'static (Fn(client::ClientResponse) -> Box<Future<Item = Problem, Error = Problem>> + Sync),
error_handler: &'static (dyn Fn(client::ClientResponse) -> Box<dyn Future<Item = Problem, Error = Problem>> + Sync),
) -> Self {
ServiceRequester {
token_creator: self.token_creator.clone(),
Expand Down
8 changes: 4 additions & 4 deletions src/subject.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ pub enum Subject {
Generic(String),
}

static ADMIN_SUBJECT: &'static str = "admin/";
static CUSTOMER_SUBJECT: &'static str = "customer/";
static SERVICE_SUBJECT: &'static str = "service/";
static API_SUBJECT: &'static str = "api/";
static ADMIN_SUBJECT: &str = "admin/";
static CUSTOMER_SUBJECT: &str = "customer/";
static SERVICE_SUBJECT: &str = "service/";
static API_SUBJECT: &str = "api/";

impl FromStr for Subject {
type Err = ::actix_web::error::Error;
Expand Down
6 changes: 3 additions & 3 deletions src/ws_try.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub trait FromClientResponse {
pub enum WSTry<F> {
MayBeSuccess(F),
Failure(Problem),
FutureFailure(Box<Future<Item = Problem, Error = Problem>>),
FutureFailure(Box<dyn Future<Item = Problem, Error = Problem>>),
}

impl<T, F> Future for WSTry<F>
Expand Down Expand Up @@ -94,7 +94,7 @@ where
R: IntoClientRequest,
T: FromClientResponse<Result = T, FutureResult = F>,
F: Future<Item = T, Error = Problem>,
E: Fn(client::ClientResponse) -> Box<Future<Item = Problem, Error = Problem>>,
E: Fn(client::ClientResponse) -> Box<dyn Future<Item = Problem, Error = Problem>>,
{
r#try(request).and_then(move |resp| {
if resp.status().is_success() {
Expand All @@ -106,7 +106,7 @@ where
}

#[allow(clippy::needless_pass_by_value)]
pub fn default_error_handler(response: client::ClientResponse) -> Box<Future<Item = Problem, Error = Problem>> {
pub fn default_error_handler(response: client::ClientResponse) -> Box<dyn Future<Item = Problem, Error = Problem>> {
Box::new(future::ok(Problem::for_status(
response.status().as_u16(),
format!("Service request failed: {}", response.status()),
Expand Down

0 comments on commit 9e25496

Please sign in to comment.