Skip to content

Commit

Permalink
Clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
bodymindarts committed Apr 8, 2021
1 parent 555b60c commit e175d52
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/repo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ impl Repo {
dir,
}: GitConfig,
) -> Result<Self> {
let callbacks = remote_callbacks(private_key)?;
let callbacks = remote_callbacks(private_key);
let mut fo = git2::FetchOptions::new();
fo.remote_callbacks(callbacks);

Expand All @@ -79,7 +79,7 @@ impl Repo {
..
}: GitConfig,
) -> Result<()> {
let callbacks = remote_callbacks(private_key)?;
let callbacks = remote_callbacks(private_key);
let mut fo = git2::FetchOptions::new();
fo.remote_callbacks(callbacks);
let mut remote = self.inner.find_remote("origin")?;
Expand All @@ -105,7 +105,7 @@ impl Repo {
..
}: GitConfig,
) -> Result<()> {
let callbacks = remote_callbacks(private_key.clone())?;
let callbacks = remote_callbacks(private_key.clone());
let mut fo = git2::FetchOptions::new();
fo.remote_callbacks(callbacks);
let mut remote = self.inner.find_remote("origin")?;
Expand Down Expand Up @@ -134,7 +134,7 @@ impl Repo {
}
rebase.finish(None)?;
let mut push_options = PushOptions::new();
push_options.remote_callbacks(remote_callbacks(private_key)?);
push_options.remote_callbacks(remote_callbacks(private_key));
remote.push(
&[format!(
"{}:{}",
Expand Down Expand Up @@ -396,10 +396,10 @@ impl Repo {
}
}

fn remote_callbacks(key: String) -> Result<RemoteCallbacks<'static>> {
fn remote_callbacks(key: String) -> RemoteCallbacks<'static> {
let mut callbacks = RemoteCallbacks::new();
callbacks.credentials(move |_url, username_from_url, _allowed_types| {
Cred::ssh_key_from_memory(username_from_url.unwrap(), None, &key, None)
});
Ok(callbacks)
callbacks
}
3 changes: 1 addition & 2 deletions src/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ impl Workspace {
.iter()
.map(|(ident, _)| ident.name())
.collect();
let ignore_list = self.ignore_list();
repo.checkout_head(Some(&file_names), ignore_list.clone())?;
repo.checkout_head(Some(&file_names), self.ignore_list())?;
}
for (ident, state) in last_state.files.iter() {
repo.checkout_file_from(&ident.name(), &state.from_commit)?;
Expand Down

0 comments on commit e175d52

Please sign in to comment.