Don't use import alias

This commit is contained in:
Valentin Brandl 2019-07-26 14:21:17 +02:00
parent 8e97cbdf3d
commit 27f7e8f35c
No known key found for this signature in database
GPG Key ID: 30D341DD34118D7D

View File

@ -15,7 +15,7 @@ use crate::{
}; };
use actix_web::{ use actix_web::{
http::header::{self, CacheControl, CacheDirective, Expires, LOCATION}, http::header::{self, CacheControl, CacheDirective, Expires, LOCATION},
middleware, web, App, Error as AError, HttpResponse, HttpServer, middleware, web, App, Error, HttpResponse, HttpServer,
}; };
use awc::{http::StatusCode, Client}; use awc::{http::StatusCode, Client};
use futures::Future; use futures::Future;
@ -24,7 +24,7 @@ use std::time::{Duration, SystemTime};
fn proxy_file<T: Service>( fn proxy_file<T: Service>(
client: web::Data<Client>, client: web::Data<Client>,
data: web::Path<FilePath>, data: web::Path<FilePath>,
) -> Box<dyn Future<Item = HttpResponse, Error = AError>> { ) -> Box<dyn Future<Item = HttpResponse, Error = Error>> {
Box::new( Box::new(
client client
.get(&T::raw_url( .get(&T::raw_url(
@ -57,7 +57,7 @@ fn proxy_file<T: Service>(
fn redirect<T: Service>( fn redirect<T: Service>(
client: web::Data<Client>, client: web::Data<Client>,
data: web::Path<FilePath>, data: web::Path<FilePath>,
) -> Box<dyn Future<Item = HttpResponse, Error = AError>> { ) -> Box<dyn Future<Item = HttpResponse, Error = Error>> {
Box::new( Box::new(
client client
.get(&T::api_url(&data)) .get(&T::api_url(&data))
@ -84,9 +84,9 @@ fn redirect<T: Service>(
}) })
.from_err(), .from_err(),
) )
as Box<dyn Future<Item = HttpResponse, Error = AError>>, as Box<dyn Future<Item = HttpResponse, Error = Error>>,
code => Box::new(futures::future::ok(HttpResponse::build(code).finish())) code => Box::new(futures::future::ok(HttpResponse::build(code).finish()))
as Box<dyn Future<Item = HttpResponse, Error = AError>>, as Box<dyn Future<Item = HttpResponse, Error = Error>>,
}), }),
) )
} }
@ -94,7 +94,7 @@ fn redirect<T: Service>(
fn handle_request<T: Service>( fn handle_request<T: Service>(
client: web::Data<Client>, client: web::Data<Client>,
data: web::Path<FilePath>, data: web::Path<FilePath>,
) -> Box<dyn Future<Item = HttpResponse, Error = AError>> { ) -> Box<dyn Future<Item = HttpResponse, Error = Error>> {
if data.commit.len() == 40 { if data.commit.len() == 40 {
proxy_file::<T>(client, data) proxy_file::<T>(client, data)
} else { } else {