Skip to content

Commit

Permalink
Use Set not Vec again
Browse files Browse the repository at this point in the history
  • Loading branch information
illicitonion committed May 15, 2018
1 parent 177541a commit b6e766f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/rust/engine/process_execution/src/lib.rs
Expand Up @@ -21,7 +21,7 @@ extern crate tempdir;
extern crate testutil;

use bytes::Bytes;
use std::collections::BTreeMap;
use std::collections::{BTreeMap, BTreeSet};
use std::path::PathBuf;

pub mod local;
Expand Down Expand Up @@ -51,7 +51,7 @@ pub struct ExecuteProcessRequest {

pub input_files: hashing::Digest,

pub output_files: Vec<PathBuf>,
pub output_files: BTreeSet<PathBuf>,
}

///
Expand Down
18 changes: 9 additions & 9 deletions src/rust/engine/process_execution/src/local.rs
Expand Up @@ -64,7 +64,7 @@ impl CommandRunner {
.map(|posix_fs| Arc::new(posix_fs))
.and_then(|posix_fs| {
posix_fs
.path_stats(output_file_paths)
.path_stats(output_file_paths.into_iter().collect())
.map_err(|e| format!("Error stating output files: {}", e))
.and_then(move |paths| {
fs::Snapshot::from_path_stats(
Expand Down Expand Up @@ -100,7 +100,7 @@ mod tests {
use futures::Future;
use super::{ExecuteProcessRequest, ExecuteProcessResult};
use std;
use std::collections::BTreeMap;
use std::collections::{BTreeMap, BTreeSet};
use std::env;
use std::os::unix::fs::PermissionsExt;
use std::path::{Path, PathBuf};
Expand All @@ -116,7 +116,7 @@ mod tests {
argv: owned_string_vec(&["/bin/echo", "-n", "foo"]),
env: BTreeMap::new(),
input_files: fs::EMPTY_DIGEST,
output_files: vec![],
output_files: BTreeSet::new(),
});

assert_eq!(
Expand All @@ -137,7 +137,7 @@ mod tests {
argv: owned_string_vec(&["/bin/bash", "-c", "echo -n foo ; echo >&2 -n bar ; exit 1"]),
env: BTreeMap::new(),
input_files: fs::EMPTY_DIGEST,
output_files: vec![],
output_files: BTreeSet::new(),
});

assert_eq!(
Expand All @@ -162,7 +162,7 @@ mod tests {
argv: owned_string_vec(&["/usr/bin/env"]),
env: env.clone(),
input_files: fs::EMPTY_DIGEST,
output_files: vec![],
output_files: BTreeSet::new(),
});

let stdout = String::from_utf8(result.unwrap().stdout.to_vec()).unwrap();
Expand Down Expand Up @@ -194,7 +194,7 @@ mod tests {
argv: owned_string_vec(&["/usr/bin/env"]),
env: env,
input_files: fs::EMPTY_DIGEST,
output_files: vec![],
output_files: BTreeSet::new(),
}
}

Expand All @@ -210,7 +210,7 @@ mod tests {
argv: owned_string_vec(&["echo", "-n", "foo"]),
env: BTreeMap::new(),
input_files: fs::EMPTY_DIGEST,
output_files: vec![],
output_files: BTreeSet::new(),
}).expect_err("Want Err");
}

Expand All @@ -224,7 +224,7 @@ mod tests {
]),
env: BTreeMap::new(),
input_files: fs::EMPTY_DIGEST,
output_files: vec![],
output_files: BTreeSet::new(),
});
assert_eq!(
result.unwrap(),
Expand Down Expand Up @@ -254,7 +254,7 @@ mod tests {
],
env: BTreeMap::new(),
input_files: fs::EMPTY_DIGEST,
output_files: vec![output_file_path.clone()],
output_files: vec![output_file_path.clone()].into_iter().collect(),
},
working_dir,
);
Expand Down
8 changes: 4 additions & 4 deletions src/rust/engine/process_execution/src/remote.rs
Expand Up @@ -472,7 +472,7 @@ mod tests {
use testutil::{as_bytes, owned_string_vec};

use super::{CommandRunner, ExecuteProcessRequest, ExecuteProcessResult, ExecutionError};
use std::collections::BTreeMap;
use std::collections::{BTreeMap, BTreeSet};
use std::iter::{self, FromIterator};
use std::sync::Arc;
use std::time::Duration;
Expand Down Expand Up @@ -501,7 +501,7 @@ mod tests {
argv: owned_string_vec(&["/bin/echo", "-n", "bar"]),
env: BTreeMap::new(),
input_files: fs::EMPTY_DIGEST,
output_files: vec![],
output_files: BTreeSet::new(),
}).unwrap()
.1,
vec![],
Expand Down Expand Up @@ -1119,7 +1119,7 @@ mod tests {
argv: owned_string_vec(&["/bin/echo", "-n", "foo"]),
env: BTreeMap::new(),
input_files: fs::EMPTY_DIGEST,
output_files: vec![],
output_files: BTreeSet::new(),
}
}

Expand Down Expand Up @@ -1266,7 +1266,7 @@ mod tests {
argv: owned_string_vec(&["/bin/cat", "roland"]),
env: BTreeMap::new(),
input_files: TestDirectory::containing_roland().digest(),
output_files: vec![],
output_files: BTreeSet::new(),
}
}
}
4 changes: 2 additions & 2 deletions src/rust/engine/process_executor/src/main.rs
Expand Up @@ -11,7 +11,7 @@ use clap::{App, AppSettings, Arg};
use futures::future::Future;
use hashing::{Digest, Fingerprint};
use tempdir::TempDir;
use std::collections::BTreeMap;
use std::collections::{BTreeMap, BTreeSet};
use std::iter::Iterator;
use std::process::exit;
use std::sync::Arc;
Expand Down Expand Up @@ -128,7 +128,7 @@ fn main() {
argv,
env,
input_files,
output_files: vec![],
output_files: BTreeSet::new(),
};

let result = match server_arg {
Expand Down

0 comments on commit b6e766f

Please sign in to comment.