Skip to content

Commit

Permalink
Run cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
emk committed Oct 11, 2016
1 parent b6b759e commit 69e262d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
11 changes: 6 additions & 5 deletions src/pod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,13 @@ impl FileInfo {
// confusing and unmaintanable overrides, and (2) the rest of this
// program's design assumes it doesn't have to worry about them.
let ours: BTreeSet<String> = self.file.services.keys().cloned().collect();
let introduced: Vec<String> = ours.difference(service_names).cloned().collect();
let introduced: Vec<String> =
ours.difference(service_names).cloned().collect();
if !introduced.is_empty() {
return Err(ErrorKind::ServicesAddedInOverride(base_file.to_owned(),
self.rel_path.clone(),
introduced).into())
introduced)
.into());
}

// Add any missing services.
Expand Down Expand Up @@ -258,16 +260,15 @@ impl Pod {
}

/// Look up a service by name.
pub fn service(&self, ovr: &Override, name: &str)
-> Result<Option<dc::Service>> {
pub fn service(&self, ovr: &Override, name: &str) -> Result<Option<dc::Service>> {
let file = try!(self.merged_file(ovr));
Ok(file.services.get(name).cloned())
}

/// Like `service`, but returns an error if the service can't be found.
pub fn service_or_err(&self, ovr: &Override, name: &str) -> Result<dc::Service> {
try!(self.service(ovr, name))
.ok_or_else(|| { ErrorKind::UnknownService(name.to_owned()).into() })
.ok_or_else(|| ErrorKind::UnknownService(name.to_owned()).into())
}

/// Command-line `-p` and `-f` arguments that we'll pass to
Expand Down
2 changes: 1 addition & 1 deletion src/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ impl Project {
/// Like `service`, but returns an error if the service is unknown.
pub fn service_or_err<'a>(&self, name: &'a str) -> Result<(&Pod, &str)> {
self.service(name)
.ok_or_else(|| { ErrorKind::UnknownService(name.to_owned()).into() })
.ok_or_else(|| ErrorKind::UnknownService(name.to_owned()).into())
}

/// Iterate over all overrides in this project.
Expand Down
5 changes: 3 additions & 2 deletions src/service_locations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use pod::Pod;
#[derive(Debug)]
pub struct ServiceLocations {
/// Our location information.
locations: BTreeMap<String, (String, String)>
locations: BTreeMap<String, (String, String)>,
}

impl ServiceLocations {
Expand Down Expand Up @@ -65,7 +65,8 @@ impl ServiceLocations {

/// Find a service by name.
pub fn find<'a>(&self, service_name: &'a str) -> Option<(&str, &str)> {
self.locations.get(service_name)
self.locations
.get(service_name)
.map(|&(ref pod, ref service)| (&pod[..], &service[..]))
}
}

0 comments on commit 69e262d

Please sign in to comment.