Skip to content

Commit 3fe5903

Browse files
Fix clippy lints
1 parent fc60f93 commit 3fe5903

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+701
-749
lines changed

cairo/src/paths.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ impl<'a> Iterator for PathSegments<'a> {
102102
to_tuple(&self.data[self.i + 3].point),
103103
),
104104
PathDataType::ClosePath => PathSegment::ClosePath,
105-
PathDataType::__Unknown(x) => panic!("Unknown value: {}", x),
105+
PathDataType::__Unknown(x) => panic!("Unknown value: {x}"),
106106
};
107107

108108
self.i += self.data[self.i].header.length as usize;

cairo/sys/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ fn main() {} // prevent linking libraries to avoid documentation failure
77
#[cfg(not(feature = "dox"))]
88
fn main() {
99
if let Err(s) = system_deps::Config::new().probe() {
10-
println!("cargo:warning={}", s);
10+
println!("cargo:warning={s}");
1111
process::exit(1);
1212
}
1313
}

examples/gio_cancellable_future/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ fn main() {
2727
let cancellable_task = gio::CancellableFuture::new(a_very_long_task(), cancellable.clone())
2828
.map(move |res| {
2929
if let Err(error) = res {
30-
println!("{:?}", error);
30+
println!("{error:?}");
3131
}
3232

3333
main_loop.quit();

examples/gio_futures/main.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ fn main() {
1717
// error first print that error.
1818
.map(move |res| {
1919
if let Err(err) = res {
20-
eprintln!("Got error: {}", err);
20+
eprintln!("Got error: {err}");
2121
}
2222

2323
l_clone.quit();
@@ -36,7 +36,7 @@ fn read_and_print_file(
3636
file: &gio::File,
3737
) -> impl Future<Output = Result<(), String>> + std::marker::Unpin {
3838
file.read_future(glib::PRIORITY_DEFAULT)
39-
.map_err(|err| format!("Failed to open file: {}", err))
39+
.map_err(|err| format!("Failed to open file: {err}"))
4040
.and_then(read_and_print_chunks)
4141
}
4242

@@ -98,9 +98,9 @@ fn read_and_print_next_chunk(
9898
) -> impl Future<Output = Result<Option<Vec<u8>>, String>> + std::marker::Unpin {
9999
let strm_clone = strm.clone();
100100
strm.read_future(buf, glib::PRIORITY_DEFAULT)
101-
.map_err(|(_buf, err)| format!("Failed to read from stream: {}", err))
101+
.map_err(|(_buf, err)| format!("Failed to read from stream: {err}"))
102102
.and_then(move |(buf, len)| {
103-
println!("line {}: {:?}", idx, str::from_utf8(&buf[0..len]).unwrap());
103+
println!("line {idx}: {:?}", str::from_utf8(&buf[0..len]).unwrap());
104104

105105
// 0 is only returned when the input stream is finished, in which case
106106
// we drop the buffer and close the stream asynchronously.
@@ -111,7 +111,7 @@ fn read_and_print_next_chunk(
111111
futures::future::Either::Left(
112112
strm_clone
113113
.close_future(glib::PRIORITY_DEFAULT)
114-
.map_err(|err| format!("Failed to close stream: {}", err))
114+
.map_err(|err| format!("Failed to close stream: {err}"))
115115
.map_ok(|_| None),
116116
)
117117
} else {

examples/gio_futures_await/main.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ fn main() {
1414
let future = clone!(@strong l => async move {
1515
match read_file(file).await {
1616
Ok(()) => (),
17-
Err(err) => eprintln!("Got error: {}", err),
17+
Err(err) => eprintln!("Got error: {err}"),
1818
}
1919
l.quit();
2020
});
@@ -30,7 +30,7 @@ async fn read_file(file: gio::File) -> Result<(), String> {
3030
// Try to open the file.
3131
let strm = file
3232
.read_future(glib::PRIORITY_DEFAULT)
33-
.map_err(|err| format!("Failed to open file: {}", err))
33+
.map_err(|err| format!("Failed to open file: {err}"))
3434
.await?;
3535

3636
// If opening the file succeeds, we asynchronously loop and
@@ -42,7 +42,7 @@ async fn read_file(file: gio::File) -> Result<(), String> {
4242
loop {
4343
let (b, len) = strm
4444
.read_future(buf, glib::PRIORITY_DEFAULT)
45-
.map_err(|(_buf, err)| format!("Failed to read from stream: {}", err))
45+
.map_err(|(_buf, err)| format!("Failed to read from stream: {err}"))
4646
.await?;
4747

4848
// Once 0 is returned, we know that we're done with reading, otherwise
@@ -53,14 +53,14 @@ async fn read_file(file: gio::File) -> Result<(), String> {
5353

5454
buf = b;
5555

56-
println!("line {}: {:?}", idx, str::from_utf8(&buf[0..len]).unwrap());
56+
println!("line {idx}: {:?}", str::from_utf8(&buf[0..len]).unwrap());
5757

5858
idx += 1;
5959
}
6060

6161
// Asynchronously close the stream in the end.
6262
strm.close_future(glib::PRIORITY_DEFAULT)
63-
.map_err(|err| format!("Failed to close stream: {}", err))
63+
.map_err(|err| format!("Failed to close stream: {err}"))
6464
.await?;
6565

6666
Ok(())

examples/gio_task/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ fn run_unsafe(send: oneshot::Sender<()>) {
5858
return;
5959
}
6060

61-
println!("Unsafe callback - Returned value from task: {}", ret);
61+
println!("Unsafe callback - Returned value from task: {ret}");
6262
println!(
6363
"Unsafe callback - FileSize::size: {}",
6464
file_size::ffi::my_file_size_get_retrieved_size(
@@ -89,7 +89,7 @@ fn run_safe(send: oneshot::Sender<()>) {
8989
let cancellable = gio::Cancellable::new();
9090

9191
let closure = move |value: i64, source_object: &FileSize| {
92-
println!("Safe callback - Returned value from task: {}", value);
92+
println!("Safe callback - Returned value from task: {value}");
9393
println!(
9494
"Safe callback - FileSize::size: {}",
9595
source_object.retrieved_size().unwrap()

gdk-pixbuf/src/auto/versions.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Generated by gir (https://github.com/gtk-rs/gir @ f0e953c094a5)
1+
Generated by gir (https://github.com/gtk-rs/gir @ 818f714dc796)
22
from gir-files (https://github.com/gtk-rs/gir-files @ 89a11aa6a362)

gdk-pixbuf/src/pixbuf.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ impl Pixbuf {
5050
let ptr = {
5151
let data: &mut [u8] = (*data).as_mut();
5252
assert!(
53-
data.len() >= ((height - 1) * row_stride + last_row_len) as usize,
53+
data.len() >= ((height - 1) * row_stride + last_row_len),
5454
"data.len() must fit the width, height, and row_stride"
5555
);
5656
data.as_mut_ptr()
@@ -406,7 +406,7 @@ impl Pixbuf {
406406
if error.is_null() {
407407
Ok(FromGlibContainer::from_glib_full_num(
408408
buffer,
409-
buffer_size.assume_init() as usize,
409+
buffer_size.assume_init() as _,
410410
))
411411
} else {
412412
Err(from_glib_full(error))

gdk-pixbuf/sys/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ fn main() {} // prevent linking libraries to avoid documentation failure
1111
#[cfg(not(feature = "dox"))]
1212
fn main() {
1313
if let Err(s) = system_deps::Config::new().probe() {
14-
println!("cargo:warning={}", s);
14+
println!("cargo:warning={s}");
1515
process::exit(1);
1616
}
1717
}

gdk-pixbuf/sys/src/lib.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ pub struct GdkPixbufAnimationClass {
127127

128128
impl ::std::fmt::Debug for GdkPixbufAnimationClass {
129129
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
130-
f.debug_struct(&format!("GdkPixbufAnimationClass @ {:p}", self))
130+
f.debug_struct(&format!("GdkPixbufAnimationClass @ {self:p}"))
131131
.field("parent_class", &self.parent_class)
132132
.field("is_static_image", &self.is_static_image)
133133
.field("get_static_image", &self.get_static_image)
@@ -152,7 +152,7 @@ pub struct GdkPixbufAnimationIterClass {
152152

153153
impl ::std::fmt::Debug for GdkPixbufAnimationIterClass {
154154
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
155-
f.debug_struct(&format!("GdkPixbufAnimationIterClass @ {:p}", self))
155+
f.debug_struct(&format!("GdkPixbufAnimationIterClass @ {self:p}"))
156156
.field("parent_class", &self.parent_class)
157157
.field("get_delay_time", &self.get_delay_time)
158158
.field("get_pixbuf", &self.get_pixbuf)
@@ -181,7 +181,7 @@ pub struct GdkPixbufFormat {
181181

182182
impl ::std::fmt::Debug for GdkPixbufFormat {
183183
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
184-
f.debug_struct(&format!("GdkPixbufFormat @ {:p}", self))
184+
f.debug_struct(&format!("GdkPixbufFormat @ {self:p}"))
185185
.field("name", &self.name)
186186
.field("signature", &self.signature)
187187
.field("domain", &self.domain)
@@ -208,7 +208,7 @@ pub struct GdkPixbufLoaderClass {
208208

209209
impl ::std::fmt::Debug for GdkPixbufLoaderClass {
210210
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
211-
f.debug_struct(&format!("GdkPixbufLoaderClass @ {:p}", self))
211+
f.debug_struct(&format!("GdkPixbufLoaderClass @ {self:p}"))
212212
.field("parent_class", &self.parent_class)
213213
.field("size_prepared", &self.size_prepared)
214214
.field("area_prepared", &self.area_prepared)
@@ -242,7 +242,7 @@ pub struct GdkPixbufModule {
242242

243243
impl ::std::fmt::Debug for GdkPixbufModule {
244244
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
245-
f.debug_struct(&format!("GdkPixbufModule @ {:p}", self))
245+
f.debug_struct(&format!("GdkPixbufModule @ {self:p}"))
246246
.field("module_name", &self.module_name)
247247
.field("module_path", &self.module_path)
248248
.field("module", &self.module)
@@ -274,7 +274,7 @@ pub struct GdkPixbufModulePattern {
274274

275275
impl ::std::fmt::Debug for GdkPixbufModulePattern {
276276
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
277-
f.debug_struct(&format!("GdkPixbufModulePattern @ {:p}", self))
277+
f.debug_struct(&format!("GdkPixbufModulePattern @ {self:p}"))
278278
.field("prefix", &self.prefix)
279279
.field("mask", &self.mask)
280280
.field("relevance", &self.relevance)
@@ -299,7 +299,7 @@ pub struct GdkPixbuf {
299299

300300
impl ::std::fmt::Debug for GdkPixbuf {
301301
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
302-
f.debug_struct(&format!("GdkPixbuf @ {:p}", self)).finish()
302+
f.debug_struct(&format!("GdkPixbuf @ {self:p}")).finish()
303303
}
304304
}
305305

@@ -311,7 +311,7 @@ pub struct GdkPixbufAnimation {
311311

312312
impl ::std::fmt::Debug for GdkPixbufAnimation {
313313
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
314-
f.debug_struct(&format!("GdkPixbufAnimation @ {:p}", self))
314+
f.debug_struct(&format!("GdkPixbufAnimation @ {self:p}"))
315315
.field("parent_instance", &self.parent_instance)
316316
.finish()
317317
}
@@ -325,7 +325,7 @@ pub struct GdkPixbufAnimationIter {
325325

326326
impl ::std::fmt::Debug for GdkPixbufAnimationIter {
327327
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
328-
f.debug_struct(&format!("GdkPixbufAnimationIter @ {:p}", self))
328+
f.debug_struct(&format!("GdkPixbufAnimationIter @ {self:p}"))
329329
.field("parent_instance", &self.parent_instance)
330330
.finish()
331331
}
@@ -340,7 +340,7 @@ pub struct GdkPixbufLoader {
340340

341341
impl ::std::fmt::Debug for GdkPixbufLoader {
342342
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
343-
f.debug_struct(&format!("GdkPixbufLoader @ {:p}", self))
343+
f.debug_struct(&format!("GdkPixbufLoader @ {self:p}"))
344344
.finish()
345345
}
346346
}
@@ -353,7 +353,7 @@ pub struct GdkPixbufNonAnim {
353353

354354
impl ::std::fmt::Debug for GdkPixbufNonAnim {
355355
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
356-
f.debug_struct(&format!("GdkPixbufNonAnim @ {:p}", self))
356+
f.debug_struct(&format!("GdkPixbufNonAnim @ {self:p}"))
357357
.finish()
358358
}
359359
}
@@ -366,7 +366,7 @@ pub struct GdkPixbufSimpleAnim {
366366

367367
impl ::std::fmt::Debug for GdkPixbufSimpleAnim {
368368
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
369-
f.debug_struct(&format!("GdkPixbufSimpleAnim @ {:p}", self))
369+
f.debug_struct(&format!("GdkPixbufSimpleAnim @ {self:p}"))
370370
.finish()
371371
}
372372
}
@@ -379,7 +379,7 @@ pub struct GdkPixbufSimpleAnimIter {
379379

380380
impl ::std::fmt::Debug for GdkPixbufSimpleAnimIter {
381381
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
382-
f.debug_struct(&format!("GdkPixbufSimpleAnimIter @ {:p}", self))
382+
f.debug_struct(&format!("GdkPixbufSimpleAnimIter @ {self:p}"))
383383
.finish()
384384
}
385385
}

0 commit comments

Comments
 (0)