Clean use of future::ok and error

This commit is contained in:
F3real 2017-05-27 14:27:35 +02:00 коммит произвёл Ted Mielczarek
Родитель ac131fc715
Коммит 007391ace2
3 изменённых файлов: 7 добавлений и 7 удалений

4
src/cache/s3.rs поставляемый
Просмотреть файл

@ -18,7 +18,7 @@ use cache::{
CacheWrite,
Storage,
};
use futures::future::{self, Future};
use futures::future::Future;
use simples3::{
AutoRefreshingProvider,
Bucket,
@ -90,7 +90,7 @@ impl Storage for S3Cache {
let start = Instant::now();
let data = match entry.finish() {
Ok(data) => data,
Err(e) => return future::err(e.into()).boxed(),
Err(e) => return f_err(e),
};
let credentials = self.provider.credentials().chain_err(|| {
"failed to get AWS credentials"

Просмотреть файл

@ -109,9 +109,9 @@ fn compile<T>(creator: &T,
let write = {
let filename = match Path::new(&parsed_args.input).file_name() {
Some(name) => name,
None => return future::err("Missing input filename".into()).boxed(),
None => return f_err("Missing input filename"),
};
Box::new(
write_temp_file(pool, filename.as_ref(), preprocessor_result.stdout.clone())
.and_then(move |(tempdir, input)| {
@ -120,7 +120,7 @@ fn compile<T>(creator: &T,
Err(_) => future::err("Failed to write input file".into()),
}
})
)
)
};
gcc::compile(creator, executable, preprocessor_result, parsed_args, cwd, env_vars, pool, Some(write))

Просмотреть файл

@ -18,7 +18,7 @@ use ::compiler::{
};
use compiler::c::{CCompilerImpl, CCompilerKind, ParsedArguments};
use log::LogLevel::Trace;
use futures::future::{self, Future};
use futures::future::Future;
use futures_cpupool::CpuPool;
use mock_command::{
CommandCreatorSync,
@ -283,7 +283,7 @@ pub fn compile<T>(creator: &T,
let out_file = match parsed_args.outputs.get("obj") {
Some(obj) => obj,
None => {
return future::err("Missing object file output".into()).boxed()
return f_err("Missing object file output")
}
};