Commit b68441b1 authored by Ben Boeckel's avatar Ben Boeckel

rustfmt: reformat `where` clauses

parent e5d3e65b
......@@ -57,8 +57,9 @@ pub struct Identity {
impl Identity {
/// Create a new identity.
pub fn new<N, E>(name: N, email: E) -> Self
where N: ToString,
E: ToString,
where
N: ToString,
E: ToString,
{
Self {
name: name.to_string(),
......@@ -105,7 +106,8 @@ impl Display for MergeStatus {
impl GitContext {
/// Create a new context for the given directory.
pub fn new<P>(gitdir: P) -> Self
where P: AsRef<Path>,
where
P: AsRef<Path>,
{
Self {
gitdir: gitdir.as_ref().to_path_buf(),
......@@ -115,8 +117,9 @@ impl GitContext {
/// Create a new context for the given directory with git configuration.
pub fn new_with_config<P, C>(gitdir: P, config: C) -> Self
where P: AsRef<Path>,
C: AsRef<Path>,
where
P: AsRef<Path>,
C: AsRef<Path>,
{
Self {
gitdir: gitdir.as_ref().to_path_buf(),
......@@ -143,9 +146,10 @@ impl GitContext {
///
/// The remote is interpreted by Git, so it can be a remote or a specific URL.
pub fn fetch<R, I, N>(&self, remote: R, refnames: I) -> Result<()>
where R: AsRef<str>,
I: IntoIterator<Item = N>,
N: AsRef<OsStr>,
where
R: AsRef<str>,
I: IntoIterator<Item = N>,
N: AsRef<OsStr>,
{
let fetch = self
.git()
......@@ -165,9 +169,10 @@ impl GitContext {
/// Fetch a commit from the given remote into a specific local refname.
pub fn fetch_into<R, N, T>(&self, remote: R, refname: N, target: T) -> Result<()>
where R: AsRef<str>,
N: AsRef<str>,
T: AsRef<str>,
where
R: AsRef<str>,
N: AsRef<str>,
T: AsRef<str>,
{
self.fetch(remote,
&[&format!("{}:{}", refname.as_ref(), target.as_ref())])
......@@ -175,9 +180,10 @@ impl GitContext {
/// Fetch a commit from the given remote into a specific local refname, allowing rewinds.
pub fn force_fetch_into<R, N, T>(&self, remote: R, refname: N, target: T) -> Result<()>
where R: AsRef<str>,
N: AsRef<str>,
T: AsRef<str>,
where
R: AsRef<str>,
N: AsRef<str>,
T: AsRef<str>,
{
self.fetch_into(remote.as_ref(),
format!("+{}", refname.as_ref()),
......@@ -196,7 +202,8 @@ impl GitContext {
/// The reserved reference is created as `refs/{name}/heads/{id}` where `id` is a unique
/// integer (which is also returned).
pub fn reserve_ref<N>(&self, name: N, commit: &CommitId) -> Result<(String, usize)>
where N: AsRef<str>,
where
N: AsRef<str>,
{
let ref_prefix = format!("refs/{}/heads", name.as_ref());
......@@ -260,7 +267,8 @@ impl GitContext {
/// It is assumed that the `bases` refs are aligned with the `heads` references and not used
/// for other purposes.
pub fn reserve_refs<N>(&self, name: N, commit: &CommitId) -> Result<(String, String)>
where N: AsRef<str>,
where
N: AsRef<str>,
{
let (new_ref, id) = self.reserve_ref(name.as_ref(), commit)?;
let new_base = format!("refs/{}/bases/{}", name.as_ref(), id);
......
......@@ -96,7 +96,8 @@ impl<'a> MergeCommand<'a> {
///
/// Returns the ID of the merge commit itself.
pub fn commit<M>(self, message: M) -> Result<CommitId>
where M: AsRef<str>,
where
M: AsRef<str>,
{
self.commit_impl(message.as_ref())
}
......@@ -191,8 +192,9 @@ trait WorkareaGitContext {
/// Checkout a set of paths into a workarea.
fn checkout<I, P>(ctx: &WorkareaGitContext, paths: I) -> Result<()>
where I: IntoIterator<Item = P>,
P: AsRef<OsStr>,
where
I: IntoIterator<Item = P>,
P: AsRef<OsStr>,
{
let ls_files = ctx
.cmd()
......@@ -509,7 +511,8 @@ impl GitWorkArea {
/// Figure out if there's a possible resolution for the submodule.
fn submodule_conflict<P>(&self, path: P, ours: &CommitId, theirs: &CommitId) -> Result<Conflict>
where P: AsRef<Path>,
where
P: AsRef<Path>,
{
let path = path.as_ref().to_path_buf();
......@@ -655,8 +658,9 @@ impl GitWorkArea {
///
/// All paths supported by Git's globbing and searching mechanisms are supported.
pub fn checkout<I, P>(&mut self, paths: I) -> Result<()>
where I: IntoIterator<Item = P>,
P: AsRef<OsStr>,
where
I: IntoIterator<Item = P>,
P: AsRef<OsStr>,
{
checkout(self, paths)
}
......
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