🧹 shorten the scope of unsafe block

This commit is contained in:
Vladislav Nepogodin 2023-03-31 21:01:07 +04:00
parent f72abe78c4
commit 28d2394824
No known key found for this signature in database
GPG Key ID: B62C3D10C54D5DA9
1 changed files with 5 additions and 7 deletions

View File

@ -305,13 +305,11 @@ fn create_options_section() -> gtk::Box {
}
for btn in &[&psd_btn, &systemd_oomd_btn, &apparmor_btn, &bluetooth_btn, &ananicy_cpp_btn] {
unsafe {
let data: &str = *btn.data("actionData").unwrap().as_ptr();
if G_LOCAL_UNITS.lock().unwrap().enabled_units.contains(&String::from(data))
|| G_GLOBAL_UNITS.lock().unwrap().enabled_units.contains(&String::from(data))
{
btn.set_active(true);
}
let data: &str = unsafe { *btn.data("actionData").unwrap().as_ptr() };
if G_LOCAL_UNITS.lock().unwrap().enabled_units.contains(&String::from(data))
|| G_GLOBAL_UNITS.lock().unwrap().enabled_units.contains(&String::from(data))
{
btn.set_active(true);
}
}