Clean up unnecessary use of RefCell

This commit is contained in:
Your Name
2023-02-19 22:32:27 -05:00
parent a5d0729bba
commit f2ac3d5fa6
2 changed files with 2 additions and 4 deletions

View File

@@ -134,7 +134,7 @@ fn main() {
.expect("failed to get initial audio devices and sessions"); .expect("failed to get initial audio devices and sessions");
let (tx, rx): (Sender<String>, Receiver<String>) = mpsc::channel(); let (tx, rx): (Sender<String>, Receiver<String>) = mpsc::channel();
*WIN_CHANGE_CHANNEL_TX.lock().unwrap().borrow_mut() = Some(tx); *WIN_CHANGE_CHANNEL_TX.lock().unwrap() = Some(tx);
thread::spawn(move || { thread::spawn(move || {
win_event_hook_loop(); win_event_hook_loop();

View File

@@ -1,5 +1,4 @@
use std::{ use std::{
cell::RefCell,
sync::{mpsc::Sender, Mutex}, sync::{mpsc::Sender, Mutex},
}; };
@@ -18,7 +17,7 @@ use windows::Win32::{
use crate::pid_to_exe::pid_to_exe_path; use crate::pid_to_exe::pid_to_exe_path;
pub static WIN_CHANGE_CHANNEL_TX: Mutex<RefCell<Option<Sender<String>>>> = Mutex::new(RefCell::new(None)); pub static WIN_CHANGE_CHANNEL_TX: Mutex<Option<Sender<String>>> = Mutex::new(None);
unsafe extern "system" fn win_event_proc( unsafe extern "system" fn win_event_proc(
_hook: HWINEVENTHOOK, _hook: HWINEVENTHOOK,
@@ -40,7 +39,6 @@ unsafe extern "system" fn win_event_proc(
WIN_CHANGE_CHANNEL_TX WIN_CHANGE_CHANNEL_TX
.lock() .lock()
.unwrap() .unwrap()
.borrow()
.as_ref() .as_ref()
.unwrap() .unwrap()
.send(path) .send(path)