Conditional YES casting

This commit is contained in:
Oskar Thornblad 2021-01-27 14:03:40 +01:00
parent abd97ebf73
commit 66f7483112
1 changed files with 7 additions and 12 deletions

View File

@ -196,21 +196,16 @@ impl Backend for AppKit {
Ok(()) Ok(())
} }
#[cfg(target_arch = "aarch64")]
fn is_speaking(&self) -> Result<bool, Error> { fn is_speaking(&self) -> Result<bool, Error> {
let is_speaking: i8 = unsafe { msg_send![self.0, isSpeaking] }; #[cfg(not(target_arch = "aarch64"))]
Ok(is_speaking == YES as i8) let yes: i8 = YES;
}
#[cfg(target_arch = "aarch64")]
let yes: i8 = match YES { true => 1, false => 0 };
#[cfg(target_arch = "x86")]
#[cfg(target_arch = "x86_64")]
#[cfg(target_arch = "mips")]
#[cfg(target_arch = "powerpc")]
#[cfg(target_arch = "powerpc64")]
#[cfg(target_arch = "arm")]
fn is_speaking(&self) -> Result<bool, Error> {
let is_speaking: i8 = unsafe { msg_send![self.0, isSpeaking] }; let is_speaking: i8 = unsafe { msg_send![self.0, isSpeaking] };
Ok(is_speaking == YES)
Ok(is_speaking == yes)
} }
} }