Commit 458474b6 authored by Ben Boeckel's avatar Ben Boeckel

rustfmt: reformat function call arguments

parent b68441b1
......@@ -93,13 +93,15 @@ pub enum MergeStatus {
impl Display for MergeStatus {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f,
"{}",
match *self {
MergeStatus::NoCommonHistory => "no common history",
MergeStatus::AlreadyMerged => "already merged",
MergeStatus::Mergeable(_) => "mergeable",
})
write!(
f,
"{}",
match *self {
MergeStatus::NoCommonHistory => "no common history",
MergeStatus::AlreadyMerged => "already merged",
MergeStatus::Mergeable(_) => "mergeable",
},
)
}
}
......@@ -159,9 +161,11 @@ impl GitContext {
.output()
.chain_err(|| "failed to construct fetch command")?;
if !fetch.status.success() {
bail!(ErrorKind::Git(format!("fetch from {} failed: {}",
remote.as_ref(),
String::from_utf8_lossy(&fetch.stderr))));
bail!(ErrorKind::Git(format!(
"fetch from {} failed: {}",
remote.as_ref(),
String::from_utf8_lossy(&fetch.stderr)
)));
}
Ok(())
......@@ -174,8 +178,10 @@ impl GitContext {
N: AsRef<str>,
T: AsRef<str>,
{
self.fetch(remote,
&[&format!("{}:{}", refname.as_ref(), target.as_ref())])
self.fetch(
remote,
&[&format!("{}:{}", refname.as_ref(), target.as_ref())],
)
}
/// Fetch a commit from the given remote into a specific local refname, allowing rewinds.
......@@ -185,9 +191,11 @@ impl GitContext {
N: AsRef<str>,
T: AsRef<str>,
{
self.fetch_into(remote.as_ref(),
format!("+{}", refname.as_ref()),
target.as_ref())
self.fetch_into(
remote.as_ref(),
format!("+{}", refname.as_ref()),
target.as_ref(),
)
}
/// Create a tree where further work on the given revision can occur.
......@@ -219,9 +227,11 @@ impl GitContext {
.output()
.chain_err(|| "failed to construct for-each-ref command")?;
if !for_each_ref.status.success() {
bail!(ErrorKind::Git(format!("listing all {} refs: {}",
ref_prefix,
String::from_utf8_lossy(&for_each_ref.stderr))));
bail!(ErrorKind::Git(format!(
"listing all {} refs: {}",
ref_prefix,
String::from_utf8_lossy(&for_each_ref.stderr)
)));
}
let refs = String::from_utf8_lossy(&for_each_ref.stdout);
......
......@@ -128,8 +128,10 @@ impl<'a> MergeCommand<'a> {
.wait_with_output()
.chain_err(|| "failed to execute commit-tree command")?;
if !commit_tree.status.success() {
bail!(ErrorKind::Git(format!("failed to commit the merged tree: {}",
String::from_utf8_lossy(&commit_tree.stderr))));
bail!(ErrorKind::Git(format!(
"failed to commit the merged tree: {}",
String::from_utf8_lossy(&commit_tree.stderr)
)));
}
let merge_commit = String::from_utf8_lossy(&commit_tree.stdout);
......@@ -204,8 +206,10 @@ where
.output()
.chain_err(|| "failed to construct ls-files command")?;
if !ls_files.status.success() {
bail!(ErrorKind::Git(format!("listing paths in the index: {}",
String::from_utf8_lossy(&ls_files.stderr))));
bail!(ErrorKind::Git(format!(
"listing paths in the index: {}",
String::from_utf8_lossy(&ls_files.stderr)
)));
}
checkout_files(ctx, &ls_files.stdout)
......@@ -241,8 +245,10 @@ fn checkout_files(ctx: &WorkareaGitContext, files: &[u8]) -> Result<()> {
.expect("expected checkout-index to have a stderr")
.read_to_end(&mut stderr)
.chain_err(|| "failed to read from checkout-index")?;
bail!(ErrorKind::Git(format!("running checkout-index: {}",
String::from_utf8_lossy(&stderr))));
bail!(ErrorKind::Git(format!(
"running checkout-index: {}",
String::from_utf8_lossy(&stderr),
)));
}
// Update the index for the files we put into the context
......@@ -272,8 +278,10 @@ fn checkout_files(ctx: &WorkareaGitContext, files: &[u8]) -> Result<()> {
.expect("expected update-index to have a stderr")
.read_to_end(&mut stderr)
.chain_err(|| "failed to read from update-index")?;
bail!(ErrorKind::Git(format!("running update-index: {}",
String::from_utf8_lossy(&stderr))));
bail!(ErrorKind::Git(format!(
"running update-index: {}",
String::from_utf8_lossy(&stderr),
)));
}
Ok(())
......@@ -326,9 +334,11 @@ impl PreparingGitWorkArea {
.output()
.chain_err(|| "failed to construct read-tree command")?;
if !res.status.success() {
bail!(ErrorKind::Git(format!("reading the tree from {}: {}",
rev,
String::from_utf8_lossy(&res.stderr))));
bail!(ErrorKind::Git(format!(
"reading the tree from {}: {}",
rev,
String::from_utf8_lossy(&res.stderr)
)));
}
// Make the index believe the working tree is fine.
......@@ -372,8 +382,10 @@ impl PreparingGitWorkArea {
.output()
.chain_err(|| "failed to construct config command for submodules")?;
if !config.status.success() {
bail!(ErrorKind::Git(format!("reading the submodule configuration: {}",
String::from_utf8_lossy(&config.stderr))));
bail!(ErrorKind::Git(format!(
"reading the submodule configuration: {}",
String::from_utf8_lossy(&config.stderr)
)));
}
let config = String::from_utf8_lossy(&config.stdout);
......@@ -384,22 +396,26 @@ impl PreparingGitWorkArea {
.filter_map(|l| SUBMODULE_CONFIG_RE.captures(l));
for capture in captures {
submodule_config
.entry(capture
.name("name")
.expect("the submodule regex should have a 'name' group")
.as_str()
.to_string())
.entry(
capture
.name("name")
.expect("the submodule regex should have a 'name' group")
.as_str()
.to_string(),
)
.or_insert_with(HashMap::new)
.insert(capture
.name("key")
.expect("the submodule regex should have a 'key' group")
.as_str()
.to_string(),
capture
.name("value")
.expect("the submodule regex should have a 'value' group")
.as_str()
.to_string());
.insert(
capture
.name("key")
.expect("the submodule regex should have a 'key' group")
.as_str()
.to_string(),
capture
.name("value")
.expect("the submodule regex should have a 'value' group")
.as_str()
.to_string(),
);
}
let gitmoduledir = self.context.gitdir().join("modules");
......@@ -486,8 +502,10 @@ impl GitWorkArea {
};
let gitfiledir = self.work_tree().join(path);
fs::create_dir_all(&gitfiledir).chain_err(|| {
format!("failed to create the {} submodule directory for the workarea",
name)
format!(
"failed to create the {} submodule directory for the workarea",
name,
)
})?;
let mut gitfile = File::create(gitfiledir.join(".git"))
......@@ -529,9 +547,7 @@ impl GitWorkArea {
submod_path.as_str() == path.to_string_lossy()
})
})
.map(|(name, config)| {
(name, config.get("branch").map_or("master", String::as_str))
});
.map(|(name, config)| (name, config.get("branch").map_or("master", String::as_str)));
let (name, branch) = if let Some((name, branch_name)) = branch_info {
if branch_name == "." {
......@@ -610,8 +626,10 @@ impl GitWorkArea {
.output()
.chain_err(|| "failed to construct ls-files command for conflict resolution")?;
if !ls_files.status.success() {
bail!(ErrorKind::Git(format!("listing unmerged files: {}",
String::from_utf8_lossy(&ls_files.stderr))));
bail!(ErrorKind::Git(format!(
"listing unmerged files: {}",
String::from_utf8_lossy(&ls_files.stderr)
)));
}
let conflicts = String::from_utf8_lossy(&ls_files.stdout);
......@@ -623,9 +641,11 @@ impl GitWorkArea {
for conflict in conflicts.lines() {
let info = conflict.split_whitespace().collect::<Vec<_>>();
assert!(info.len() == 4,
"expected 4 entries for a conflict, received {}",
info.len());
assert!(
info.len() == 4,
"expected 4 entries for a conflict, received {}",
info.len(),
);
let permissions = info[0];
let hash = info[1];
......@@ -724,8 +744,10 @@ impl GitWorkArea {
.output()
.chain_err(|| "failed to construct write-tree command")?;
if !write_tree.status.success() {
bail!(ErrorKind::Git(format!("writing the tree object: {}",
String::from_utf8_lossy(&write_tree.stderr))));
bail!(ErrorKind::Git(format!(
"writing the tree object: {}",
String::from_utf8_lossy(&write_tree.stderr)
)));
}
let merged_tree = String::from_utf8_lossy(&write_tree.stdout);
let merged_tree = merged_tree.trim();
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment