Skip to content

Commit

Permalink
lint macos
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog committed Aug 3, 2023
1 parent 78616b4 commit 98e6ff4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions core/tauri/src/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ impl<R: Runtime> WindowManager<R> {
#[cfg(target_os = "macos")]
return None;

#[cfg_attr(target_os = "macos", allow(unused_variables, unreachable_code))]
if let Some(menu) = &window_menu {
let menu = menu.menu.clone();
Some(move |raw: tauri_runtime::window::RawWindow<'_>| {
Expand Down
8 changes: 8 additions & 0 deletions core/tauri/src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1216,6 +1216,7 @@ impl<R: Runtime> Window<R> {
self.menu.lock().expect("poisoned window")
}

#[cfg_attr(target_os = "macos", allow(dead_code))]
pub(crate) fn has_app_wide_menu(&self) -> bool {
self
.menu_lock()
Expand All @@ -1224,6 +1225,7 @@ impl<R: Runtime> Window<R> {
.unwrap_or(false)
}

#[cfg_attr(target_os = "macos", allow(dead_code))]
pub(crate) fn is_menu_in_use(&self, id: u32) -> bool {
self
.menu_lock()
Expand All @@ -1243,6 +1245,7 @@ impl<R: Runtime> Window<R> {
///
/// - **macOS:** Unsupported. The menu on macOS is app-wide and not specific to one
/// window, if you need to set it, use [`AppHandle::set_menu`] instead.
#[cfg_attr(target_os = "macos", allow(unused_variables))]
pub fn set_menu(&self, menu: Menu<R>) -> crate::Result<Option<Menu<R>>> {
let prev_menu = self.remove_menu()?;

Expand Down Expand Up @@ -1287,6 +1290,7 @@ impl<R: Runtime> Window<R> {
let mut current_menu = self.menu_lock();

// remove from the window
#[cfg_attr(target_os = "macos", allow(unused_variables))]
if let Some(window_menu) = &*current_menu {
let window = self.clone();
let menu_ = window_menu.menu.clone();
Expand Down Expand Up @@ -1322,6 +1326,7 @@ impl<R: Runtime> Window<R> {
/// Hides the window menu.
pub fn hide_menu(&self) -> crate::Result<()> {
// remove from the window
#[cfg_attr(target_os = "macos", allow(unused_variables))]
if let Some(window_menu) = &*self.menu_lock() {
let window = self.clone();
let menu_ = window_menu.menu.clone();
Expand Down Expand Up @@ -1349,6 +1354,7 @@ impl<R: Runtime> Window<R> {
/// Shows the window menu.
pub fn show_menu(&self) -> crate::Result<()> {
// remove from the window
#[cfg_attr(target_os = "macos", allow(unused_variables))]
if let Some(window_menu) = &*self.menu_lock() {
let window = self.clone();
let menu_ = window_menu.menu.clone();
Expand All @@ -1374,8 +1380,10 @@ impl<R: Runtime> Window<R> {
}

/// Shows the window menu.

pub fn is_menu_visible(&self) -> crate::Result<bool> {
// remove from the window
#[cfg_attr(target_os = "macos", allow(unused_variables))]
if let Some(window_menu) = &*self.menu_lock() {
let (tx, rx) = std::sync::mpsc::channel();
let window = self.clone();
Expand Down

0 comments on commit 98e6ff4

Please sign in to comment.