Repository: tauri-apps/tauri
File: core/tauri/src/app.rs (Rust)

Code before:
          .manager
          .inner
          .menu_event_listeners
          .lock()
          .unwrap()
          .push(Box::new(handler));
      }

      /// Registers a global tray icon menu event listener.
      #[cfg(all(desktop, feature = "tray-icon"))]
      #[cfg_attr(doc_cfg, doc(cfg(all(desktop, feature = "tray-icon"))))]
      pub fn on_tray_icon_event<F: Fn(&AppHandle<R>, TrayIconEvent) + Send + Sync + 'static>(
        &self,
        handler: F,
      ) {
        self
          .manager
          .inner
          .global_tray_event_listeners
          .lock()
          .unwrap()
          .push(Box::new(handler));
      }

      /// Gets the first tray icon registerd,
      /// usually the one configured in tauri configuration file,
      #[cfg(all(desktop, feature = "tray-icon"))]
      #[cfg_attr(doc_cfg, doc(cfg(all(desktop, feature = "tray-icon"))))]
      pub fn tray(&self) -> Option<TrayIcon<R>> {
        self
          .manager
          .inner
          .tray_icons
          .lock()
          .unwrap()
          .first()
          .cloned()
      }

      /// Removes the first tray icon registerd, usually the one configured in
      /// tauri config file, from tauri's internal state and returns it.
      ///
      /// Note that dropping the returned icon, will cause the tray icon to disappear.
      #[cfg(all(desktop, feature = "tray-icon"))]
      #[cfg_attr(doc_cfg, doc(cfg(all(desktop, feature = "tray-icon"))))]
      pub fn remove_tray(&self) -> Option<TrayIcon<R>> {
        let mut tray_icons = self.manager.inner.tray_icons.lock().unwrap();
        if !tray_icons.is_empty() {
          return Some(tray_icons.swap_remove(0));
        }
        None

Review comment (suggestion):
```suggestion
      /// usually the one configured in the Tauri configuration file.
```

Code after:
          .manager
          .inner
          .menu_event_listeners
          .lock()
          .unwrap()
          .push(Box::new(handler));
      }

      /// Registers a global tray icon menu event listener.
      #[cfg(all(desktop, feature = "tray-icon"))]
      #[cfg_attr(doc_cfg, doc(cfg(all(desktop, feature = "tray-icon"))))]
      pub fn on_tray_icon_event<F: Fn(&AppHandle<R>, TrayIconEvent) + Send + Sync + 'static>(
        &self,
        handler: F,
      ) {
        self
          .manager
          .inner
          .global_tray_event_listeners
          .lock()
          .unwrap()
          .push(Box::new(handler));
      }

      /// Gets the first tray icon registered,
      /// usually the one configured in the Tauri configuration file.
      #[cfg(all(desktop, feature = "tray-icon"))]
      #[cfg_attr(doc_cfg, doc(cfg(all(desktop, feature = "tray-icon"))))]
      pub fn tray(&self) -> Option<TrayIcon<R>> {
        self
          .manager
          .inner
          .tray_icons
          .lock()
          .unwrap()
          .first()
          .cloned()
      }

      /// Removes the first tray icon registerd, usually the one configured in
      /// tauri config file, from tauri's internal state and returns it.
      ///
      /// Note that dropping the returned icon, will cause the tray icon to disappear.
      #[cfg(all(desktop, feature = "tray-icon"))]
      #[cfg_attr(doc_cfg, doc(cfg(all(desktop, feature = "tray-icon"))))]
      pub fn remove_tray(&self) -> Option<TrayIcon<R>> {
        let mut tray_icons = self.manager.inner.tray_icons.lock().unwrap();
        if !tray_icons.is_empty() {
          return Some(tray_icons.swap_remove(0));
        }
        None