Skip to content

Commit 9f3578c

Browse files
authored
fix(clippy): fix enum variant names lint (#119)
[the build](https://github.com/sassman/t-rec-rs/runs/5356845166?check_suite_focus=true#step:5:200) broke because of the enum variant prefix `_`, the variants have been renamed
1 parent a66e7ae commit 9f3578c

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/macos/window_id.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ use std::os::raw::c_void;
1616

1717
#[derive(Debug)]
1818
enum DictEntryValue {
19-
_Number(i64),
20-
_Bool(bool),
21-
_String(String),
22-
_Unknown,
19+
Number(i64),
20+
Bool(bool),
21+
String(String),
22+
Unknown,
2323
}
2424

2525
///
@@ -56,7 +56,7 @@ pub fn window_list() -> Result<WindowList> {
5656
}
5757
let window_owner = get_from_dict(dic_ref, "kCGWindowOwnerName");
5858
let window_id = get_from_dict(dic_ref, "kCGWindowNumber");
59-
if let (DictEntryValue::_String(name), DictEntryValue::_Number(win_id)) =
59+
if let (DictEntryValue::String(name), DictEntryValue::Number(win_id)) =
6060
(window_owner, window_id)
6161
{
6262
win_list.push((Some(name), win_id as u64));
@@ -83,29 +83,29 @@ fn get_from_dict(dict: CFDictionaryRef, key: &str) -> DictEntryValue {
8383
let out_value: *mut i64 = &mut value_i64;
8484
let converted = unsafe { CFNumberGetValue(value, I64, out_value.cast()) };
8585
if converted {
86-
return DictEntryValue::_Number(value_i64);
86+
return DictEntryValue::Number(value_i64);
8787
}
8888
}
8989
I32 => {
9090
let mut value_i32 = 0_i32;
9191
let out_value: *mut i32 = &mut value_i32;
9292
let converted = unsafe { CFNumberGetValue(value, I32, out_value.cast()) };
9393
if converted {
94-
return DictEntryValue::_Number(value_i32 as i64);
94+
return DictEntryValue::Number(value_i32 as i64);
9595
}
9696
}
9797
n => {
9898
eprintln!("Unsupported Number of typeId: {}", n);
9999
}
100100
}
101101
} else if type_id == unsafe { CFBooleanGetTypeID() } {
102-
return DictEntryValue::_Bool(unsafe { CFBooleanGetValue(value.cast()) });
102+
return DictEntryValue::Bool(unsafe { CFBooleanGetValue(value.cast()) });
103103
} else if type_id == unsafe { CFStringGetTypeID() } {
104104
let c_ptr = unsafe { CFStringGetCStringPtr(value.cast(), kCFStringEncodingUTF8) };
105105
return if !c_ptr.is_null() {
106106
let c_result = unsafe { CStr::from_ptr(c_ptr) };
107107
let result = String::from(c_result.to_str().unwrap());
108-
DictEntryValue::_String(result)
108+
DictEntryValue::String(result)
109109
} else {
110110
// in this case there is a high chance we got a `NSString` instead of `CFString`
111111
// we have to use the objc runtime to fetch it
@@ -115,14 +115,14 @@ fn get_from_dict(dict: CFDictionaryRef, key: &str) -> DictEntryValue {
115115
let str = std::str::from_utf8(nss.deref().as_str().as_bytes());
116116

117117
match str {
118-
Ok(s) => DictEntryValue::_String(s.to_owned()),
119-
Err(_) => DictEntryValue::_Unknown,
118+
Ok(s) => DictEntryValue::String(s.to_owned()),
119+
Err(_) => DictEntryValue::Unknown,
120120
}
121121
};
122122
} else {
123123
eprintln!("Unexpected type: {}", type_id);
124124
}
125125
}
126126

127-
DictEntryValue::_Unknown
127+
DictEntryValue::Unknown
128128
}

0 commit comments

Comments
 (0)