Skip to content

Commit

Permalink
thanks clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Aug 28, 2020
1 parent 8b843f2 commit 712527f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
4 changes: 2 additions & 2 deletions git-transport/src/client/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl SpawnProcessOnDemand {
path: BString,
) -> SpawnProcessOnDemand {
SpawnProcessOnDemand {
path: path.into(),
path,
ssh_program: Some(program),
ssh_args: args.into_iter().map(|s| s.into()).collect(),
ssh_env: env.into_iter().map(|(k, v)| (k, v.into())).collect(),
Expand All @@ -59,7 +59,7 @@ impl SpawnProcessOnDemand {
}
pub(crate) fn new(path: BString) -> SpawnProcessOnDemand {
SpawnProcessOnDemand {
path: path.into(),
path,
ssh_program: None,
ssh_args: Vec::new(),
ssh_env: Vec::new(),
Expand Down
12 changes: 5 additions & 7 deletions git-transport/src/client/ssh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,15 @@ pub fn connect(
let mut ssh_cmd_line = ssh_cmd_line.split(' ');
let ssh_cmd = ssh_cmd_line.next().expect("there is always a single item");

let args_and_env: Option<(Vec<Cow<str>>, Vec<(&'static str, String)>)> = match ssh_cmd {
type EnvVar = (&'static str, String);
let args_and_env: Option<(Vec<Cow<str>>, Vec<EnvVar>)> = match ssh_cmd {
"ssh" | "ssh.exe" => {
if version != Protocol::V1 {
let mut args = vec![Cow::from("-o"), format!("SendEnv=GIT_PROTOCOL").into()];
let mut args = vec![Cow::from("-o"), "SendEnv=GIT_PROTOCOL".into()];
if let Some(port) = port {
args.push(format!("-p={}", port).into());
}
Some((
args,
vec![("GIT_PROTOCOL", format!("version={}", version as usize).into())],
))
Some((args, vec![("GIT_PROTOCOL", format!("version={}", version as usize))]))
} else {
None
}
Expand All @@ -48,7 +46,7 @@ pub fn connect(
Ok(match args_and_env {
Some((args, envs)) => client::file::SpawnProcessOnDemand::new_ssh(
ssh_cmd.into(),
ssh_cmd_line.map(|s| Cow::from(s)).chain(args).chain(Some(host.into())),
ssh_cmd_line.map(Cow::from).chain(args).chain(Some(host.into())),
envs,
path,
),
Expand Down

0 comments on commit 712527f

Please sign in to comment.