From 13cd1142e5cdcf2c106c04c1394309aadc335daa Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Sun, 13 Jul 2025 01:38:26 -0400 Subject: [PATCH] Fix clippy lints. (#736) --- cocoa/examples/color.rs | 4 ++-- core-foundation/src/dictionary.rs | 4 ++-- core-foundation/src/runloop.rs | 2 +- core-foundation/src/string.rs | 2 +- core-foundation/src/url.rs | 2 +- core-text/src/font.rs | 7 +++---- 6 files changed, 10 insertions(+), 11 deletions(-) diff --git a/cocoa/examples/color.rs b/cocoa/examples/color.rs index e97cb54..f72b3d3 100644 --- a/cocoa/examples/color.rs +++ b/cocoa/examples/color.rs @@ -68,7 +68,7 @@ fn main() { let cs_name_bytes = cs_name.UTF8String() as *const u8; let cs_name_string = 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. let cg_cs = cs.CGColorSpace(); @@ -77,7 +77,7 @@ fn main() { let cs_name_bytes = cs_name.UTF8String() as *const u8; let cs_name_string = 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(); } diff --git a/core-foundation/src/dictionary.rs b/core-foundation/src/dictionary.rs index 26c3ca9..951bc80 100644 --- a/core-foundation/src/dictionary.rs +++ b/core-foundation/src/dictionary.rs @@ -130,7 +130,7 @@ impl CFDictionary { { let ptr = key.to_void(); 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>) { @@ -266,7 +266,7 @@ impl CFMutableDictionary { { let ptr = key.to_void(); 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>) { diff --git a/core-foundation/src/runloop.rs b/core-foundation/src/runloop.rs index e3f1e26..a2ac79e 100644 --- a/core-foundation/src/runloop.rs +++ b/core-foundation/src/runloop.rs @@ -227,7 +227,7 @@ mod test { } CFRunLoop::run_current(); 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); } diff --git a/core-foundation/src/string.rs b/core-foundation/src/string.rs index b58d371..21b441a 100644 --- a/core-foundation/src/string.rs +++ b/core-foundation/src/string.rs @@ -107,7 +107,7 @@ impl fmt::Display for CFString { impl fmt::Debug for CFString { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "\"{}\"", self) + write!(f, "\"{self}\"") } } diff --git a/core-foundation/src/url.rs b/core-foundation/src/url.rs index 8e39191..5bef794 100644 --- a/core-foundation/src/url.rs +++ b/core-foundation/src/url.rs @@ -35,7 +35,7 @@ impl fmt::Debug for CFURL { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { unsafe { let string: CFString = TCFType::wrap_under_get_rule(CFURLGetString(self.0)); - write!(f, "{}", string) + write!(f, "{string}") } } } diff --git a/core-text/src/font.rs b/core-text/src/font.rs index c1db6b8..4b9a815 100644 --- a/core-text/src/font.rs +++ b/core-text/src/font.rs @@ -907,7 +907,7 @@ fn copy_system_font() { // but we can still construct the CGFont by name let cgfont = CGFont::from_name(&CFString::new(&ps)).unwrap(); let cgfont = new_from_CGFont(&cgfont, 0.); - println!("{:?}", cgfont); + println!("{cgfont:?}"); let desc = cgfont.copy_descriptor(); let matching = unsafe { crate::font_descriptor::CTFontDescriptorCreateMatchingFontDescriptor( @@ -923,7 +923,7 @@ fn copy_system_font() { .find(CFString::from_static_string("NSFontSizeAttribute")) .is_some()); - println!("{:?}", matching); + println!("{matching:?}"); println!( "{:?}", matching @@ -1030,8 +1030,7 @@ fn out_of_range_variations() { let expected = max + clamp_diff; assert_eq!( val, expected, - "axis {:?} = {:?} (expected {:?})", - tag, val, expected + "axis {tag:?} = {val:?} (expected {expected:?})", ); } }