Skip to content

Commit cc7a2b1

Browse files
authored
Merge pull request #816 from GuillaumeGomez/fix-lints
Fix new clippy lints
2 parents 78bc5a6 + 3fe5903 commit cc7a2b1

File tree

109 files changed

+989
-1038
lines changed

Some content is hidden

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

109 files changed

+989
-1038
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/flags.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ bitflags! {
1010
#[doc(alias = "GdkPixbufFormatFlags")]
1111
pub struct PixbufFormatFlags: u32 {
1212
#[doc(alias = "GDK_PIXBUF_FORMAT_WRITABLE")]
13-
const WRITABLE = ffi::GDK_PIXBUF_FORMAT_WRITABLE as u32;
13+
const WRITABLE = ffi::GDK_PIXBUF_FORMAT_WRITABLE as _;
1414
#[doc(alias = "GDK_PIXBUF_FORMAT_SCALABLE")]
15-
const SCALABLE = ffi::GDK_PIXBUF_FORMAT_SCALABLE as u32;
15+
const SCALABLE = ffi::GDK_PIXBUF_FORMAT_SCALABLE as _;
1616
#[doc(alias = "GDK_PIXBUF_FORMAT_THREADSAFE")]
17-
const THREADSAFE = ffi::GDK_PIXBUF_FORMAT_THREADSAFE as u32;
17+
const THREADSAFE = ffi::GDK_PIXBUF_FORMAT_THREADSAFE as _;
1818
}
1919
}
2020

gdk-pixbuf/src/auto/pixbuf_loader.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ impl<O: IsA<PixbufLoader>> PixbufLoaderExt for O {
154154
}
155155

156156
fn write(&self, buf: &[u8]) -> Result<(), glib::Error> {
157-
let count = buf.len() as usize;
157+
let count = buf.len() as _;
158158
unsafe {
159159
let mut error = ptr::null_mut();
160160
let is_ok = ffi::gdk_pixbuf_loader_write(

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 @ 952ff416b599)
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))

0 commit comments

Comments
 (0)