Fix clippy lints. (#736)

This commit is contained in:
Josh Matthews
2025-07-13 01:38:26 -04:00
committed by GitHub
parent 1626428a0b
commit 13cd1142e5
6 changed files with 10 additions and 11 deletions
+2 -2
View File
@@ -68,7 +68,7 @@ fn main() {
let cs_name_bytes = cs_name.UTF8String() as *const u8; let cs_name_bytes = cs_name.UTF8String() as *const u8;
let cs_name_string = let cs_name_string =
std::str::from_utf8(std::slice::from_raw_parts(cs_name_bytes, cs_name.len())).unwrap(); std::str::from_utf8(std::slice::from_raw_parts(cs_name_bytes, cs_name.len())).unwrap();
println!("NSColorSpace: {:?}", cs_name_string); println!("NSColorSpace: {cs_name_string:?}");
// Creating an NSColorSpace from CGColorSpaceRef. // Creating an NSColorSpace from CGColorSpaceRef.
let cg_cs = cs.CGColorSpace(); let cg_cs = cs.CGColorSpace();
@@ -77,7 +77,7 @@ fn main() {
let cs_name_bytes = cs_name.UTF8String() as *const u8; let cs_name_bytes = cs_name.UTF8String() as *const u8;
let cs_name_string = let cs_name_string =
std::str::from_utf8(std::slice::from_raw_parts(cs_name_bytes, cs_name.len())).unwrap(); std::str::from_utf8(std::slice::from_raw_parts(cs_name_bytes, cs_name.len())).unwrap();
println!("initWithCGColorSpace_: {:?}", cs_name_string); println!("initWithCGColorSpace_: {cs_name_string:?}");
app.run(); app.run();
} }
+2 -2
View File
@@ -130,7 +130,7 @@ impl<K, V> CFDictionary<K, V> {
{ {
let ptr = key.to_void(); let ptr = key.to_void();
self.find(key) self.find(key)
.unwrap_or_else(|| panic!("No entry found for key {:p}", ptr)) .unwrap_or_else(|| panic!("No entry found for key {ptr:p}"))
} }
pub fn get_keys_and_values(&self) -> (Vec<*const c_void>, Vec<*const c_void>) { pub fn get_keys_and_values(&self) -> (Vec<*const c_void>, Vec<*const c_void>) {
@@ -266,7 +266,7 @@ impl<K, V> CFMutableDictionary<K, V> {
{ {
let ptr = key.to_void(); let ptr = key.to_void();
self.find(key) self.find(key)
.unwrap_or_else(|| panic!("No entry found for key {:p}", ptr)) .unwrap_or_else(|| panic!("No entry found for key {ptr:p}"))
} }
pub fn get_keys_and_values(&self) -> (Vec<*const c_void>, Vec<*const c_void>) { pub fn get_keys_and_values(&self) -> (Vec<*const c_void>, Vec<*const c_void>) {
+1 -1
View File
@@ -227,7 +227,7 @@ mod test {
} }
CFRunLoop::run_current(); CFRunLoop::run_current();
let elapsed = elapsed_rx.try_recv().unwrap(); let elapsed = elapsed_rx.try_recv().unwrap();
println!("wait_200_milliseconds, elapsed: {}", elapsed); println!("wait_200_milliseconds, elapsed: {elapsed}");
assert!(elapsed > 0.19 && elapsed < 0.35); assert!(elapsed > 0.19 && elapsed < 0.35);
} }
+1 -1
View File
@@ -107,7 +107,7 @@ impl fmt::Display for CFString {
impl fmt::Debug for CFString { impl fmt::Debug for CFString {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "\"{}\"", self) write!(f, "\"{self}\"")
} }
} }
+1 -1
View File
@@ -35,7 +35,7 @@ impl fmt::Debug for CFURL {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
unsafe { unsafe {
let string: CFString = TCFType::wrap_under_get_rule(CFURLGetString(self.0)); let string: CFString = TCFType::wrap_under_get_rule(CFURLGetString(self.0));
write!(f, "{}", string) write!(f, "{string}")
} }
} }
} }
+3 -4
View File
@@ -907,7 +907,7 @@ fn copy_system_font() {
// but we can still construct the CGFont by name // but we can still construct the CGFont by name
let cgfont = CGFont::from_name(&CFString::new(&ps)).unwrap(); let cgfont = CGFont::from_name(&CFString::new(&ps)).unwrap();
let cgfont = new_from_CGFont(&cgfont, 0.); let cgfont = new_from_CGFont(&cgfont, 0.);
println!("{:?}", cgfont); println!("{cgfont:?}");
let desc = cgfont.copy_descriptor(); let desc = cgfont.copy_descriptor();
let matching = unsafe { let matching = unsafe {
crate::font_descriptor::CTFontDescriptorCreateMatchingFontDescriptor( crate::font_descriptor::CTFontDescriptorCreateMatchingFontDescriptor(
@@ -923,7 +923,7 @@ fn copy_system_font() {
.find(CFString::from_static_string("NSFontSizeAttribute")) .find(CFString::from_static_string("NSFontSizeAttribute"))
.is_some()); .is_some());
println!("{:?}", matching); println!("{matching:?}");
println!( println!(
"{:?}", "{:?}",
matching matching
@@ -1030,8 +1030,7 @@ fn out_of_range_variations() {
let expected = max + clamp_diff; let expected = max + clamp_diff;
assert_eq!( assert_eq!(
val, expected, val, expected,
"axis {:?} = {:?} (expected {:?})", "axis {tag:?} = {val:?} (expected {expected:?})",
tag, val, expected
); );
} }
} }