Skip to content

Commit 13cd114

Browse files
authored
Fix clippy lints. (#736)
1 parent 1626428 commit 13cd114

File tree

6 files changed

+10
-11
lines changed

6 files changed

+10
-11
lines changed

cocoa/examples/color.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ fn main() {
6868
let cs_name_bytes = cs_name.UTF8String() as *const u8;
6969
let cs_name_string =
7070
std::str::from_utf8(std::slice::from_raw_parts(cs_name_bytes, cs_name.len())).unwrap();
71-
println!("NSColorSpace: {:?}", cs_name_string);
71+
println!("NSColorSpace: {cs_name_string:?}");
7272

7373
// Creating an NSColorSpace from CGColorSpaceRef.
7474
let cg_cs = cs.CGColorSpace();
@@ -77,7 +77,7 @@ fn main() {
7777
let cs_name_bytes = cs_name.UTF8String() as *const u8;
7878
let cs_name_string =
7979
std::str::from_utf8(std::slice::from_raw_parts(cs_name_bytes, cs_name.len())).unwrap();
80-
println!("initWithCGColorSpace_: {:?}", cs_name_string);
80+
println!("initWithCGColorSpace_: {cs_name_string:?}");
8181

8282
app.run();
8383
}

core-foundation/src/dictionary.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ impl<K, V> CFDictionary<K, V> {
130130
{
131131
let ptr = key.to_void();
132132
self.find(key)
133-
.unwrap_or_else(|| panic!("No entry found for key {:p}", ptr))
133+
.unwrap_or_else(|| panic!("No entry found for key {ptr:p}"))
134134
}
135135

136136
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> {
266266
{
267267
let ptr = key.to_void();
268268
self.find(key)
269-
.unwrap_or_else(|| panic!("No entry found for key {:p}", ptr))
269+
.unwrap_or_else(|| panic!("No entry found for key {ptr:p}"))
270270
}
271271

272272
pub fn get_keys_and_values(&self) -> (Vec<*const c_void>, Vec<*const c_void>) {

core-foundation/src/runloop.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ mod test {
227227
}
228228
CFRunLoop::run_current();
229229
let elapsed = elapsed_rx.try_recv().unwrap();
230-
println!("wait_200_milliseconds, elapsed: {}", elapsed);
230+
println!("wait_200_milliseconds, elapsed: {elapsed}");
231231
assert!(elapsed > 0.19 && elapsed < 0.35);
232232
}
233233

core-foundation/src/string.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ impl fmt::Display for CFString {
107107

108108
impl fmt::Debug for CFString {
109109
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
110-
write!(f, "\"{}\"", self)
110+
write!(f, "\"{self}\"")
111111
}
112112
}
113113

core-foundation/src/url.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ impl fmt::Debug for CFURL {
3535
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
3636
unsafe {
3737
let string: CFString = TCFType::wrap_under_get_rule(CFURLGetString(self.0));
38-
write!(f, "{}", string)
38+
write!(f, "{string}")
3939
}
4040
}
4141
}

core-text/src/font.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -907,7 +907,7 @@ fn copy_system_font() {
907907
// but we can still construct the CGFont by name
908908
let cgfont = CGFont::from_name(&CFString::new(&ps)).unwrap();
909909
let cgfont = new_from_CGFont(&cgfont, 0.);
910-
println!("{:?}", cgfont);
910+
println!("{cgfont:?}");
911911
let desc = cgfont.copy_descriptor();
912912
let matching = unsafe {
913913
crate::font_descriptor::CTFontDescriptorCreateMatchingFontDescriptor(
@@ -923,7 +923,7 @@ fn copy_system_font() {
923923
.find(CFString::from_static_string("NSFontSizeAttribute"))
924924
.is_some());
925925

926-
println!("{:?}", matching);
926+
println!("{matching:?}");
927927
println!(
928928
"{:?}",
929929
matching
@@ -1030,8 +1030,7 @@ fn out_of_range_variations() {
10301030
let expected = max + clamp_diff;
10311031
assert_eq!(
10321032
val, expected,
1033-
"axis {:?} = {:?} (expected {:?})",
1034-
tag, val, expected
1033+
"axis {tag:?} = {val:?} (expected {expected:?})",
10351034
);
10361035
}
10371036
}

0 commit comments

Comments
 (0)