1
0
Fork 0

Run rustfmt
continuous-integration/drone/push Build is failing Details

master
Ambrose Chua 2019-08-04 05:19:20 +08:00
parent 282d58bf7b
commit ed19c269c4
Signed by: ambrose
GPG Key ID: B34FBE029276BA5D
1 changed files with 19 additions and 7 deletions

View File

@ -1,8 +1,9 @@
#![feature(proc_macro_hygiene, decl_macro)]
#[macro_use] extern crate rocket;
use rocket::State;
#[macro_use]
extern crate rocket;
use rocket::response::content;
use rocket::State;
use core::time::Duration;
use futures::future::Future;
@ -11,8 +12,8 @@ use cuid::slug;
use rusoto_core::region::Region;
use rusoto_credential::{AwsCredentials, EnvironmentProvider, ProvideAwsCredentials};
use rusoto_s3::PutObjectRequest;
use rusoto_s3::util::{PreSignedRequest, PreSignedRequestOption};
use rusoto_s3::PutObjectRequest;
#[get("/")]
fn index() -> content::Html<&'static str> {
@ -89,7 +90,10 @@ fn upload(api: State<Api>) -> String {
}
fn main() {
rocket::ignite().manage(Api::new()).mount("/", routes![index, upload]).launch();
rocket::ignite()
.manage(Api::new())
.mount("/", routes![index, upload])
.launch();
}
struct Api {
@ -128,10 +132,15 @@ impl Api {
slug().unwrap()
}
fn read_region() -> String {
std::env::var("AWS_DEFAULT_REGION").or_else(|_| std::env::var("AWS_REGION")).map_err(|_| RegionError::new("No AWS_DEFAULT_REGION in environment")).unwrap()
std::env::var("AWS_DEFAULT_REGION")
.or_else(|_| std::env::var("AWS_REGION"))
.map_err(|_| RegionError::new("No AWS_DEFAULT_REGION in environment"))
.unwrap()
}
fn read_region_endpoint() -> String {
std::env::var("AWS_BASE_URL").map_err(|_| RegionError::new("No AWS_BASE_URL in environment")).unwrap()
std::env::var("AWS_BASE_URL")
.map_err(|_| RegionError::new("No AWS_BASE_URL in environment"))
.unwrap()
}
}
@ -141,7 +150,10 @@ struct RegionError {
}
impl RegionError {
pub fn new<S>(message: S) -> Self where S: ToString {
pub fn new<S>(message: S) -> Self
where
S: ToString,
{
RegionError {
message: message.to_string(),
}