diff options
author | a-kenji <aks.kenji@protonmail.com> | 2022-06-15 14:03:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-15 14:03:11 +0200 |
commit | 3de59dac42c05de43beba2f7d09b07111c711394 (patch) | |
tree | 4fa43bd6a337b781f3883c959ce0713369efd7e2 /src | |
parent | 7314b623219f93384c08dd6f7fa33def082a8419 (diff) |
fix(clippy): clippy fixes (#1508)
* fix(clippy): clippy fixes
* chore(fmt): cargo fmt
Diffstat (limited to 'src')
-rw-r--r-- | src/commands.rs | 65 | ||||
-rw-r--r-- | src/sessions.rs | 6 |
2 files changed, 33 insertions, 38 deletions
diff --git a/src/commands.rs b/src/commands.rs index 7715d4353..ae3d4f848 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -140,43 +140,40 @@ pub(crate) fn send_action_to_session(opts: zellij_utils::cli::CliArgs) { fn attach_with_fake_client(opts: zellij_utils::cli::CliArgs, name: &str) { if let Some(zellij_utils::cli::Command::Sessions(zellij_utils::cli::Sessions::Action { - action, + action: Some(action), })) = opts.command.clone() { - if let Some(action) = action.clone() { - let action = format!("[{}]", action); - match zellij_utils::serde_yaml::from_str::<ActionsFromYaml>(&action).into_diagnostic() { - Ok(parsed) => { - let (config, _, config_options) = match Setup::from_options(&opts) { - Ok(results) => results, - Err(e) => { - eprintln!("{}", e); - process::exit(1); - }, - }; - let os_input = - get_os_input(zellij_client::os_input_output::get_client_os_input); + let action = format!("[{}]", action); + match zellij_utils::serde_yaml::from_str::<ActionsFromYaml>(&action).into_diagnostic() { + Ok(parsed) => { + let (config, _, config_options) = match Setup::from_options(&opts) { + Ok(results) => results, + Err(e) => { + eprintln!("{}", e); + process::exit(1); + }, + }; + let os_input = get_os_input(zellij_client::os_input_output::get_client_os_input); - let actions = parsed.actions().to_vec(); - log::debug!("Starting fake Zellij client!"); - zellij_client::fake_client::start_fake_client( - Box::new(os_input), - opts, - *Box::new(config), - config_options, - ClientInfo::New(name.to_string()), - None, - actions, - ); - log::debug!("Quitting fake client now."); - std::process::exit(0); - }, - Err(e) => { - eprintln!("{:?}", e); - std::process::exit(1); - }, - }; - } + let actions = parsed.actions().to_vec(); + log::debug!("Starting fake Zellij client!"); + zellij_client::fake_client::start_fake_client( + Box::new(os_input), + opts, + *Box::new(config), + config_options, + ClientInfo::New(name.to_string()), + None, + actions, + ); + log::debug!("Quitting fake client now."); + std::process::exit(0); + }, + Err(e) => { + eprintln!("{:?}", e); + std::process::exit(1); + }, + }; }; } diff --git a/src/sessions.rs b/src/sessions.rs index 38f783977..fc42b610b 100644 --- a/src/sessions.rs +++ b/src/sessions.rs @@ -57,10 +57,8 @@ fn assert_socket(name: &str) -> bool { sender.send(ClientToServerMsg::ConnStatus); let mut receiver: IpcReceiverWithContext<ServerToClientMsg> = sender.get_receiver(); match receiver.recv() { - Some((instruction, _)) => { - matches!(instruction, ServerToClientMsg::Connected) - }, - None => false, + Some((ServerToClientMsg::Connected, _)) => true, + None | Some((_, _)) => false, } }, Err(e) if e.kind() == io::ErrorKind::ConnectionRefused => { |