on master help sign in
cfg-gate unused functions on macos & windows (#2332)
77ff8d3Kirawi
helix-view/src/clipboard.rs+4
@@ -14,6 +14,7 @@ pub trait ClipboardProvider: std::fmt::Debug {
14 fn set_contents(&mut self, contents: String, clipboard_type: ClipboardType) -> Result<()>;
14 fn set_contents(&mut self, contents: String, clipboard_type: ClipboardType) -> Result<()>;
15}
15}
16
16
17+#[cfg(not(windows))]
17macro_rules! command_provider {
18macro_rules! command_provider {
18 (paste => $get_prg:literal $( , $get_arg:literal )* ; copy => $set_prg:literal $( , $set_arg:literal )* ; ) => {{
19 (paste => $get_prg:literal $( , $get_arg:literal )* ; copy => $set_prg:literal $( , $set_arg:literal )* ; ) => {{
19 Box::new(provider::command::Provider {
20 Box::new(provider::command::Provider {
@@ -212,14 +213,17 @@ mod provider {
212 use super::*;
213 use super::*;
213 use anyhow::{bail, Context as _, Result};
214 use anyhow::{bail, Context as _, Result};
214
215
216+ #[cfg(not(windows))]
215 pub fn exists(executable_name: &str) -> bool {
217 pub fn exists(executable_name: &str) -> bool {
216 which::which(executable_name).is_ok()
218 which::which(executable_name).is_ok()
217 }
219 }
218
220
221+ #[cfg(not(any(windows, target_os = "macos")))]
219 pub fn env_var_is_set(env_var_name: &str) -> bool {
222 pub fn env_var_is_set(env_var_name: &str) -> bool {
220 std::env::var_os(env_var_name).is_some()
223 std::env::var_os(env_var_name).is_some()
221 }
224 }
222
225
226+ #[cfg(not(any(windows, target_os = "macos")))]
223 pub fn is_exit_success(program: &str, args: &[&str]) -> bool {
227 pub fn is_exit_success(program: &str, args: &[&str]) -> bool {
224 std::process::Command::new(program)
228 std::process::Command::new(program)
225 .args(args)
229 .args(args)