chore(repo): prune dead code and duplicate abstractions (#3413)

This commit is contained in:
Hampus authored and GitHub committed 2026-10-12 13:09:42 +02:00
1 parent c17091768c
commit c9fdf8fead
2937 files changed
+42233 -176793

No files matched your search

+5 -53
View File
@@ -7,7 +7,7 @@ const STATUS_DENIED: &str = "denied";
const STATUS_NOT_DETERMINED: &str = "not-determined";
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[cfg_attr(not(any(target_os = "macos", test)), allow(dead_code))]
#[cfg_attr(not(target_os = "macos"), allow(dead_code))]
enum TccStatus {
Granted,
Denied,
@@ -24,12 +24,12 @@ impl TccStatus {
}
}
#[cfg_attr(not(any(target_os = "macos", test)), allow(dead_code))]
#[cfg_attr(not(target_os = "macos"), allow(dead_code))]
const IOHID_ACCESS_GRANTED: u32 = 0;
#[cfg_attr(not(any(target_os = "macos", test)), allow(dead_code))]
#[cfg_attr(not(target_os = "macos"), allow(dead_code))]
const IOHID_ACCESS_DENIED: u32 = 1;
#[cfg_attr(not(any(target_os = "macos", test)), allow(dead_code))]
#[cfg_attr(not(target_os = "macos"), allow(dead_code))]
const fn input_monitoring_status_from_iohid(access: u32) -> TccStatus {
match access {
IOHID_ACCESS_GRANTED => TccStatus::Granted,
@@ -69,7 +69,7 @@ pub fn probe_input_monitoring_access() -> String {
))
}
#[cfg_attr(not(any(target_os = "macos", test)), allow(dead_code))]
#[cfg_attr(not(target_os = "macos"), allow(dead_code))]
const fn input_monitoring_status_from_tap(created: Option<bool>) -> TccStatus {
match created {
Some(true) => TccStatus::Granted,
@@ -154,51 +154,3 @@ mod platform {
None
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn status_strings_match_js_contract() {
assert_eq!(TccStatus::Granted.as_str(), "granted");
assert_eq!(TccStatus::Denied.as_str(), "denied");
assert_eq!(TccStatus::NotDetermined.as_str(), "not-determined");
}
#[test]
fn input_monitoring_maps_known_iohid_statuses() {
assert_eq!(
input_monitoring_status_from_iohid(IOHID_ACCESS_GRANTED),
TccStatus::Granted
);
assert_eq!(
input_monitoring_status_from_iohid(IOHID_ACCESS_DENIED),
TccStatus::Denied
);
assert_eq!(
input_monitoring_status_from_iohid(2),
TccStatus::NotDetermined
);
assert_eq!(
input_monitoring_status_from_iohid(u32::MAX),
TccStatus::NotDetermined
);
}
#[test]
fn input_monitoring_maps_tap_probe_results() {
assert_eq!(
input_monitoring_status_from_tap(Some(true)),
TccStatus::Granted
);
assert_eq!(
input_monitoring_status_from_tap(Some(false)),
TccStatus::Denied
);
assert_eq!(
input_monitoring_status_from_tap(None),
TccStatus::NotDetermined
);
}
}