Skip to content

Commit 595814b

Browse files
committed
fix lint
1 parent ad8f454 commit 595814b

File tree

3 files changed

+16
-19
lines changed

3 files changed

+16
-19
lines changed

crates/gpui/examples/tray.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use gpui::{
2-
App, Application, Context, Global, Image, MenuItem, SharedString, Tray, Window, WindowOptions,
2+
App, Application, Context, Global, MenuItem, SharedString, Tray, Window, WindowOptions,
33
actions, div, prelude::*,
44
};
55

crates/gpui/src/platform/windows/tray.rs

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1+
// Tray icon implementation for Windows.
2+
//
3+
// Some code reference from:
4+
// https://github.com/tauri-apps/tray-icon/blob/cb22cd5df6b0938aaeebd6c302ec50bc696d8b1a/src/platform_impl/windows/mod.rs
5+
6+
use crate::*;
17
use image::EncodableLayout;
2-
use itertools::Itertools;
3-
///! Tray icon implementation for Windows.
4-
///
5-
///! Some code reference from:
6-
///! https://github.com/tauri-apps/tray-icon/blob/cb22cd5df6b0938aaeebd6c302ec50bc696d8b1a/src/platform_impl/windows/mod.rs
78
use std::{
8-
io::Read,
99
mem,
1010
rc::Rc,
1111
sync::{
@@ -21,8 +21,6 @@ use windows::{
2121
core::*,
2222
};
2323

24-
use crate::*;
25-
2624
const PLATFORM_TRAY_CLASS_NAME: PCWSTR = w!("GPUI::PlatformTray");
2725
const WM_USER_TRAYICON: u32 = 6002;
2826
const WM_USER_UPDATE_TRAYMENU: u32 = 6003;
@@ -34,14 +32,14 @@ static WM_TASKBAR_RESTART: LazyLock<u32> =
3432
LazyLock::new(|| unsafe { RegisterWindowMessageA(s!("TaskbarCreated")) });
3533
static COUNTER: AtomicU32 = AtomicU32::new(0);
3634

37-
pub(super) struct WindowsTray {
35+
pub(crate) struct WindowsTray {
3836
tray_id: u32,
3937
hwnd: HWND,
4038
visible: bool,
4139
}
4240

4341
impl WindowsTray {
44-
pub(super) fn create(tray: &Tray) -> Self {
42+
pub(crate) fn create(tray: &Tray) -> Self {
4543
let tray_id = COUNTER.fetch_add(1, Ordering::Relaxed);
4644
let mut this = Self {
4745
tray_id,
@@ -52,7 +50,7 @@ impl WindowsTray {
5250
this
5351
}
5452

55-
pub(super) fn update(&mut self, tray: &Tray) {
53+
pub(crate) fn update(&mut self, tray: &Tray) {
5654
self.set_visible(tray.visible);
5755
if !self.visible {
5856
return;
@@ -95,8 +93,8 @@ impl WindowsTray {
9593
let hwnd = result.expect("Failed to create tray window");
9694

9795
if !register_tray_icon(hwnd, tray_id, None, None) {
98-
let _ = unsafe {
99-
DestroyWindow(hwnd);
96+
unsafe {
97+
let _ = DestroyWindow(hwnd);
10098
};
10199
return hwnd;
102100
}
@@ -167,8 +165,7 @@ impl WindowsTray {
167165
}
168166
}
169167
}
170-
171-
pub(super) struct TrayUserData {
168+
struct TrayUserData {
172169
hwnd: HWND,
173170
tray_id: u32,
174171
hpopupmenu: Option<HMENU>,
@@ -327,8 +324,8 @@ unsafe extern "system" fn tray_procedure(
327324

328325
fn show_tray_menu(hwnd: HWND, menu: HMENU, x: i32, y: i32) {
329326
unsafe {
330-
SetForegroundWindow(hwnd);
331-
TrackPopupMenu(
327+
let _ = SetForegroundWindow(hwnd);
328+
let _ = TrackPopupMenu(
332329
menu,
333330
TPM_BOTTOMALIGN | TPM_LEFTALIGN,
334331
x,

crates/gpui/src/tray.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::rc::Rc;
22

3-
use crate::{App, Image, MenuItem, SharedString};
3+
use crate::{App, MenuItem, SharedString};
44

55
/// System tray icon.
66
#[derive(Clone)]

0 commit comments

Comments
 (0)