From 42489e63d43740c600d5b53b5471a7fb407a6fa2 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Fri, 4 Nov 2022 09:17:20 -0400 Subject: [PATCH 1/6] Move `g_cancellable_set_error_if_cancelled()` to manual Regression from this change: https://github.com/gtk-rs/gtk-rs-core/commit/7c9b36c270a945012a2f5d07c8d0f11912d66d34#diff-8439ea6875c9b60b7d07a7b39f6dde1d31d38459f7c27173e56b4cecb0eadefaR142 Basically `g_cancellable_set_error_if_cancelled()` doesn't follow the GError conventions - it's the inverse, it returns `TRUE` if an error was set, and `FALSE` otherwise. We need to move this to manual implementation. I caught this while updating ostree-rs-ext to use gio 0.15, and our https://github.com/ostreedev/ostree-rs-ext/blob/main/lib/src/tokio_util.rs unit test started to panic. --- gio/Gir.toml | 3 +++ gio/src/auto/cancellable.rs | 20 -------------------- gio/src/cancellable.rs | 29 +++++++++++++++++++++++++++++ gio/src/subclass/async_initable.rs | 1 - 4 files changed, 32 insertions(+), 21 deletions(-) diff --git a/gio/Gir.toml b/gio/Gir.toml index 2d1b433d8e54..6982eb7838ba 100644 --- a/gio/Gir.toml +++ b/gio/Gir.toml @@ -398,6 +398,9 @@ manual_traits = ["CancellableExtManual"] name = "cancelled" # Racy, use 'connect' and 'disconnect' instead ignore = true + [[object.function]] + name = "set_error_if_cancelled" + manual = true [[object]] name = "Gio.CharsetConverter" diff --git a/gio/src/auto/cancellable.rs b/gio/src/auto/cancellable.rs index 57d36e39b0e6..e260e6b43537 100644 --- a/gio/src/auto/cancellable.rs +++ b/gio/src/auto/cancellable.rs @@ -5,7 +5,6 @@ use glib::object::IsA; use glib::translate::*; use std::fmt; -use std::ptr; glib::wrapper! { #[doc(alias = "GCancellable")] @@ -62,9 +61,6 @@ pub trait CancellableExt: 'static { #[doc(alias = "g_cancellable_release_fd")] fn release_fd(&self); - - #[doc(alias = "g_cancellable_set_error_if_cancelled")] - fn set_error_if_cancelled(&self) -> Result<(), glib::Error>; } impl> CancellableExt for O { @@ -107,22 +103,6 @@ impl> CancellableExt for O { ffi::g_cancellable_release_fd(self.as_ref().to_glib_none().0); } } - - fn set_error_if_cancelled(&self) -> Result<(), glib::Error> { - unsafe { - let mut error = ptr::null_mut(); - let is_ok = ffi::g_cancellable_set_error_if_cancelled( - self.as_ref().to_glib_none().0, - &mut error, - ); - assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } - } - } } impl fmt::Display for Cancellable { diff --git a/gio/src/cancellable.rs b/gio/src/cancellable.rs index ceaacb770570..2c6c7a7a4ddc 100644 --- a/gio/src/cancellable.rs +++ b/gio/src/cancellable.rs @@ -75,6 +75,10 @@ pub trait CancellableExtManual { /// Returns a `Future` that completes when the cancellable becomes cancelled. Completes /// immediately if the cancellable is already cancelled. fn future(&self) -> std::pin::Pin + Send + Sync + 'static>>; + // rustdoc-stripper-ignore-next + /// Set an error if the cancellable is already cancelled. + #[doc(alias = "g_cancellable_set_error_if_cancelled")] + fn set_error_if_cancelled(&self) -> Result<(), glib::Error>; } impl> CancellableExtManual for O { @@ -136,6 +140,24 @@ impl> CancellableExtManual for O { } }) } + + fn set_error_if_cancelled(&self) -> Result<(), glib::Error> { + unsafe { + let mut error = std::ptr::null_mut(); + let is_ok = ffi::g_cancellable_set_error_if_cancelled( + self.as_ref().to_glib_none().0, + &mut error, + ); + // Here's the special case, this function has an inverted + // return value for the error case. + assert_eq!(is_ok == glib::ffi::GFALSE, error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } + } + } } #[cfg(test)] @@ -158,6 +180,13 @@ mod tests { c.disconnect_cancelled(id.unwrap()); } + #[test] + fn cancellable_error_if_cancelled() { + let c = Cancellable::new(); + c.cancel(); + assert!(c.set_error_if_cancelled().is_err()); + } + #[test] fn cancellable_future() { let c = Cancellable::new(); diff --git a/gio/src/subclass/async_initable.rs b/gio/src/subclass/async_initable.rs index 75c7b160fec6..b03095bd3743 100644 --- a/gio/src/subclass/async_initable.rs +++ b/gio/src/subclass/async_initable.rs @@ -9,7 +9,6 @@ use glib::subclass::prelude::*; use std::ptr; -use crate::prelude::CancellableExt; use crate::prelude::CancellableExtManual; use crate::AsyncInitable; use crate::AsyncResult; From f37280d6440ca777d65cc0870d37bc1447096dc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sat, 12 Nov 2022 17:25:37 +0200 Subject: [PATCH 2/6] Update gir --- gir | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gir b/gir index f92952f3f7ea..e79806af2905 160000 --- a/gir +++ b/gir @@ -1 +1 @@ -Subproject commit f92952f3f7ea3c880558d57668129747ee1bec90 +Subproject commit e79806af290523b63a3e500a4457ba32253bfcca From 51d16049ed22eded699cd1d4800e32b22986d384 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sat, 12 Nov 2022 17:26:18 +0200 Subject: [PATCH 3/6] Regenerate with latest gir --- gdk-pixbuf/src/auto/versions.txt | 2 +- gdk-pixbuf/sys/tests/abi.rs | 20 ++++++++------------ gdk-pixbuf/sys/versions.txt | 2 +- gio/src/auto/versions.txt | 2 +- gio/sys/tests/abi.rs | 20 ++++++++------------ gio/sys/versions.txt | 2 +- glib/gobject-sys/tests/abi.rs | 20 ++++++++------------ glib/gobject-sys/versions.txt | 2 +- glib/src/auto/versions.txt | 2 +- glib/sys/tests/abi.rs | 20 ++++++++------------ glib/sys/versions.txt | 2 +- graphene/src/auto/versions.txt | 2 +- graphene/sys/tests/abi.rs | 20 ++++++++------------ graphene/sys/versions.txt | 2 +- pango/src/auto/versions.txt | 2 +- pango/sys/tests/abi.rs | 20 ++++++++------------ pango/sys/versions.txt | 2 +- pangocairo/src/auto/versions.txt | 2 +- pangocairo/sys/versions.txt | 2 +- 19 files changed, 61 insertions(+), 85 deletions(-) diff --git a/gdk-pixbuf/src/auto/versions.txt b/gdk-pixbuf/src/auto/versions.txt index 2de31b181f59..74cd19185a07 100644 --- a/gdk-pixbuf/src/auto/versions.txt +++ b/gdk-pixbuf/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ f92952f3f7ea) +Generated by gir (https://github.com/gtk-rs/gir @ e79806af2905) from gir-files (https://github.com/gtk-rs/gir-files @ 89a11aa6a362) diff --git a/gdk-pixbuf/sys/tests/abi.rs b/gdk-pixbuf/sys/tests/abi.rs index 4a97902a9b14..0dcd5c3c79a3 100644 --- a/gdk-pixbuf/sys/tests/abi.rs +++ b/gdk-pixbuf/sys/tests/abi.rs @@ -40,7 +40,7 @@ impl Compiler { cmd.arg(out); let status = cmd.spawn()?.wait()?; if !status.success() { - return Err(format!("compilation command {:?} failed, {}", &cmd, status).into()); + return Err(format!("compilation command {cmd:?} failed, {status}").into()); } Ok(()) } @@ -56,7 +56,7 @@ fn get_var(name: &str, default: &str) -> Result, Box> { match env::var(name) { Ok(value) => Ok(shell_words::split(&value)?), Err(env::VarError::NotPresent) => Ok(shell_words::split(default)?), - Err(err) => Err(format!("{} {}", name, err).into()), + Err(err) => Err(format!("{name} {err}").into()), } } @@ -70,7 +70,7 @@ fn pkg_config_cflags(packages: &[&str]) -> Result, Box> { cmd.args(packages); let out = cmd.output()?; if !out.status.success() { - return Err(format!("command {:?} returned {}", &cmd, out.status).into()); + return Err(format!("command {cmd:?} returned {}", out.status).into()); } let stdout = str::from_utf8(&out.stdout)?; Ok(shell_words::split(stdout.trim())?) @@ -126,15 +126,14 @@ fn cross_validate_constants_with_c() { { if rust_name != c_name { results.record_failed(); - eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,); + eprintln!("Name mismatch:\nRust: {rust_name:?}\nC: {c_name:?}"); continue; } if rust_value != c_value { results.record_failed(); eprintln!( - "Constant value mismatch for {}\nRust: {:?}\nC: {:?}", - rust_name, rust_value, &c_value + "Constant value mismatch for {rust_name}\nRust: {rust_value:?}\nC: {c_value:?}", ); continue; } @@ -164,16 +163,13 @@ fn cross_validate_layout_with_c() { { if rust_name != c_name { results.record_failed(); - eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,); + eprintln!("Name mismatch:\nRust: {rust_name:?}\nC: {c_name:?}"); continue; } if rust_layout != c_layout { results.record_failed(); - eprintln!( - "Layout mismatch for {}\nRust: {:?}\nC: {:?}", - rust_name, rust_layout, &c_layout - ); + eprintln!("Layout mismatch for {rust_name}\nRust: {rust_layout:?}\nC: {c_layout:?}",); continue; } @@ -194,7 +190,7 @@ fn get_c_output(name: &str) -> Result> { let mut abi_cmd = Command::new(exe); let output = abi_cmd.output()?; if !output.status.success() { - return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into()); + return Err(format!("command {abi_cmd:?} failed, {output:?}").into()); } Ok(String::from_utf8(output.stdout)?) diff --git a/gdk-pixbuf/sys/versions.txt b/gdk-pixbuf/sys/versions.txt index 2de31b181f59..74cd19185a07 100644 --- a/gdk-pixbuf/sys/versions.txt +++ b/gdk-pixbuf/sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ f92952f3f7ea) +Generated by gir (https://github.com/gtk-rs/gir @ e79806af2905) from gir-files (https://github.com/gtk-rs/gir-files @ 89a11aa6a362) diff --git a/gio/src/auto/versions.txt b/gio/src/auto/versions.txt index 2de31b181f59..74cd19185a07 100644 --- a/gio/src/auto/versions.txt +++ b/gio/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ f92952f3f7ea) +Generated by gir (https://github.com/gtk-rs/gir @ e79806af2905) from gir-files (https://github.com/gtk-rs/gir-files @ 89a11aa6a362) diff --git a/gio/sys/tests/abi.rs b/gio/sys/tests/abi.rs index a350d0d6ad1f..acc698210cd7 100644 --- a/gio/sys/tests/abi.rs +++ b/gio/sys/tests/abi.rs @@ -40,7 +40,7 @@ impl Compiler { cmd.arg(out); let status = cmd.spawn()?.wait()?; if !status.success() { - return Err(format!("compilation command {:?} failed, {}", &cmd, status).into()); + return Err(format!("compilation command {cmd:?} failed, {status}").into()); } Ok(()) } @@ -56,7 +56,7 @@ fn get_var(name: &str, default: &str) -> Result, Box> { match env::var(name) { Ok(value) => Ok(shell_words::split(&value)?), Err(env::VarError::NotPresent) => Ok(shell_words::split(default)?), - Err(err) => Err(format!("{} {}", name, err).into()), + Err(err) => Err(format!("{name} {err}").into()), } } @@ -70,7 +70,7 @@ fn pkg_config_cflags(packages: &[&str]) -> Result, Box> { cmd.args(packages); let out = cmd.output()?; if !out.status.success() { - return Err(format!("command {:?} returned {}", &cmd, out.status).into()); + return Err(format!("command {cmd:?} returned {}", out.status).into()); } let stdout = str::from_utf8(&out.stdout)?; Ok(shell_words::split(stdout.trim())?) @@ -126,15 +126,14 @@ fn cross_validate_constants_with_c() { { if rust_name != c_name { results.record_failed(); - eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,); + eprintln!("Name mismatch:\nRust: {rust_name:?}\nC: {c_name:?}"); continue; } if rust_value != c_value { results.record_failed(); eprintln!( - "Constant value mismatch for {}\nRust: {:?}\nC: {:?}", - rust_name, rust_value, &c_value + "Constant value mismatch for {rust_name}\nRust: {rust_value:?}\nC: {c_value:?}", ); continue; } @@ -164,16 +163,13 @@ fn cross_validate_layout_with_c() { { if rust_name != c_name { results.record_failed(); - eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,); + eprintln!("Name mismatch:\nRust: {rust_name:?}\nC: {c_name:?}"); continue; } if rust_layout != c_layout { results.record_failed(); - eprintln!( - "Layout mismatch for {}\nRust: {:?}\nC: {:?}", - rust_name, rust_layout, &c_layout - ); + eprintln!("Layout mismatch for {rust_name}\nRust: {rust_layout:?}\nC: {c_layout:?}",); continue; } @@ -194,7 +190,7 @@ fn get_c_output(name: &str) -> Result> { let mut abi_cmd = Command::new(exe); let output = abi_cmd.output()?; if !output.status.success() { - return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into()); + return Err(format!("command {abi_cmd:?} failed, {output:?}").into()); } Ok(String::from_utf8(output.stdout)?) diff --git a/gio/sys/versions.txt b/gio/sys/versions.txt index 2de31b181f59..74cd19185a07 100644 --- a/gio/sys/versions.txt +++ b/gio/sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ f92952f3f7ea) +Generated by gir (https://github.com/gtk-rs/gir @ e79806af2905) from gir-files (https://github.com/gtk-rs/gir-files @ 89a11aa6a362) diff --git a/glib/gobject-sys/tests/abi.rs b/glib/gobject-sys/tests/abi.rs index 281ff68434e8..738a21d6894a 100644 --- a/glib/gobject-sys/tests/abi.rs +++ b/glib/gobject-sys/tests/abi.rs @@ -40,7 +40,7 @@ impl Compiler { cmd.arg(out); let status = cmd.spawn()?.wait()?; if !status.success() { - return Err(format!("compilation command {:?} failed, {}", &cmd, status).into()); + return Err(format!("compilation command {cmd:?} failed, {status}").into()); } Ok(()) } @@ -56,7 +56,7 @@ fn get_var(name: &str, default: &str) -> Result, Box> { match env::var(name) { Ok(value) => Ok(shell_words::split(&value)?), Err(env::VarError::NotPresent) => Ok(shell_words::split(default)?), - Err(err) => Err(format!("{} {}", name, err).into()), + Err(err) => Err(format!("{name} {err}").into()), } } @@ -70,7 +70,7 @@ fn pkg_config_cflags(packages: &[&str]) -> Result, Box> { cmd.args(packages); let out = cmd.output()?; if !out.status.success() { - return Err(format!("command {:?} returned {}", &cmd, out.status).into()); + return Err(format!("command {cmd:?} returned {}", out.status).into()); } let stdout = str::from_utf8(&out.stdout)?; Ok(shell_words::split(stdout.trim())?) @@ -126,15 +126,14 @@ fn cross_validate_constants_with_c() { { if rust_name != c_name { results.record_failed(); - eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,); + eprintln!("Name mismatch:\nRust: {rust_name:?}\nC: {c_name:?}"); continue; } if rust_value != c_value { results.record_failed(); eprintln!( - "Constant value mismatch for {}\nRust: {:?}\nC: {:?}", - rust_name, rust_value, &c_value + "Constant value mismatch for {rust_name}\nRust: {rust_value:?}\nC: {c_value:?}", ); continue; } @@ -164,16 +163,13 @@ fn cross_validate_layout_with_c() { { if rust_name != c_name { results.record_failed(); - eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,); + eprintln!("Name mismatch:\nRust: {rust_name:?}\nC: {c_name:?}"); continue; } if rust_layout != c_layout { results.record_failed(); - eprintln!( - "Layout mismatch for {}\nRust: {:?}\nC: {:?}", - rust_name, rust_layout, &c_layout - ); + eprintln!("Layout mismatch for {rust_name}\nRust: {rust_layout:?}\nC: {c_layout:?}",); continue; } @@ -194,7 +190,7 @@ fn get_c_output(name: &str) -> Result> { let mut abi_cmd = Command::new(exe); let output = abi_cmd.output()?; if !output.status.success() { - return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into()); + return Err(format!("command {abi_cmd:?} failed, {output:?}").into()); } Ok(String::from_utf8(output.stdout)?) diff --git a/glib/gobject-sys/versions.txt b/glib/gobject-sys/versions.txt index 2de31b181f59..74cd19185a07 100644 --- a/glib/gobject-sys/versions.txt +++ b/glib/gobject-sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ f92952f3f7ea) +Generated by gir (https://github.com/gtk-rs/gir @ e79806af2905) from gir-files (https://github.com/gtk-rs/gir-files @ 89a11aa6a362) diff --git a/glib/src/auto/versions.txt b/glib/src/auto/versions.txt index 2de31b181f59..74cd19185a07 100644 --- a/glib/src/auto/versions.txt +++ b/glib/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ f92952f3f7ea) +Generated by gir (https://github.com/gtk-rs/gir @ e79806af2905) from gir-files (https://github.com/gtk-rs/gir-files @ 89a11aa6a362) diff --git a/glib/sys/tests/abi.rs b/glib/sys/tests/abi.rs index 605642343983..3634a2a295f7 100644 --- a/glib/sys/tests/abi.rs +++ b/glib/sys/tests/abi.rs @@ -40,7 +40,7 @@ impl Compiler { cmd.arg(out); let status = cmd.spawn()?.wait()?; if !status.success() { - return Err(format!("compilation command {:?} failed, {}", &cmd, status).into()); + return Err(format!("compilation command {cmd:?} failed, {status}").into()); } Ok(()) } @@ -56,7 +56,7 @@ fn get_var(name: &str, default: &str) -> Result, Box> { match env::var(name) { Ok(value) => Ok(shell_words::split(&value)?), Err(env::VarError::NotPresent) => Ok(shell_words::split(default)?), - Err(err) => Err(format!("{} {}", name, err).into()), + Err(err) => Err(format!("{name} {err}").into()), } } @@ -70,7 +70,7 @@ fn pkg_config_cflags(packages: &[&str]) -> Result, Box> { cmd.args(packages); let out = cmd.output()?; if !out.status.success() { - return Err(format!("command {:?} returned {}", &cmd, out.status).into()); + return Err(format!("command {cmd:?} returned {}", out.status).into()); } let stdout = str::from_utf8(&out.stdout)?; Ok(shell_words::split(stdout.trim())?) @@ -126,15 +126,14 @@ fn cross_validate_constants_with_c() { { if rust_name != c_name { results.record_failed(); - eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,); + eprintln!("Name mismatch:\nRust: {rust_name:?}\nC: {c_name:?}"); continue; } if rust_value != c_value { results.record_failed(); eprintln!( - "Constant value mismatch for {}\nRust: {:?}\nC: {:?}", - rust_name, rust_value, &c_value + "Constant value mismatch for {rust_name}\nRust: {rust_value:?}\nC: {c_value:?}", ); continue; } @@ -164,16 +163,13 @@ fn cross_validate_layout_with_c() { { if rust_name != c_name { results.record_failed(); - eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,); + eprintln!("Name mismatch:\nRust: {rust_name:?}\nC: {c_name:?}"); continue; } if rust_layout != c_layout { results.record_failed(); - eprintln!( - "Layout mismatch for {}\nRust: {:?}\nC: {:?}", - rust_name, rust_layout, &c_layout - ); + eprintln!("Layout mismatch for {rust_name}\nRust: {rust_layout:?}\nC: {c_layout:?}",); continue; } @@ -194,7 +190,7 @@ fn get_c_output(name: &str) -> Result> { let mut abi_cmd = Command::new(exe); let output = abi_cmd.output()?; if !output.status.success() { - return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into()); + return Err(format!("command {abi_cmd:?} failed, {output:?}").into()); } Ok(String::from_utf8(output.stdout)?) diff --git a/glib/sys/versions.txt b/glib/sys/versions.txt index 2de31b181f59..74cd19185a07 100644 --- a/glib/sys/versions.txt +++ b/glib/sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ f92952f3f7ea) +Generated by gir (https://github.com/gtk-rs/gir @ e79806af2905) from gir-files (https://github.com/gtk-rs/gir-files @ 89a11aa6a362) diff --git a/graphene/src/auto/versions.txt b/graphene/src/auto/versions.txt index 2de31b181f59..74cd19185a07 100644 --- a/graphene/src/auto/versions.txt +++ b/graphene/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ f92952f3f7ea) +Generated by gir (https://github.com/gtk-rs/gir @ e79806af2905) from gir-files (https://github.com/gtk-rs/gir-files @ 89a11aa6a362) diff --git a/graphene/sys/tests/abi.rs b/graphene/sys/tests/abi.rs index 803f4ee93bdd..43448c05dc3c 100644 --- a/graphene/sys/tests/abi.rs +++ b/graphene/sys/tests/abi.rs @@ -40,7 +40,7 @@ impl Compiler { cmd.arg(out); let status = cmd.spawn()?.wait()?; if !status.success() { - return Err(format!("compilation command {:?} failed, {}", &cmd, status).into()); + return Err(format!("compilation command {cmd:?} failed, {status}").into()); } Ok(()) } @@ -56,7 +56,7 @@ fn get_var(name: &str, default: &str) -> Result, Box> { match env::var(name) { Ok(value) => Ok(shell_words::split(&value)?), Err(env::VarError::NotPresent) => Ok(shell_words::split(default)?), - Err(err) => Err(format!("{} {}", name, err).into()), + Err(err) => Err(format!("{name} {err}").into()), } } @@ -70,7 +70,7 @@ fn pkg_config_cflags(packages: &[&str]) -> Result, Box> { cmd.args(packages); let out = cmd.output()?; if !out.status.success() { - return Err(format!("command {:?} returned {}", &cmd, out.status).into()); + return Err(format!("command {cmd:?} returned {}", out.status).into()); } let stdout = str::from_utf8(&out.stdout)?; Ok(shell_words::split(stdout.trim())?) @@ -126,15 +126,14 @@ fn cross_validate_constants_with_c() { { if rust_name != c_name { results.record_failed(); - eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,); + eprintln!("Name mismatch:\nRust: {rust_name:?}\nC: {c_name:?}"); continue; } if rust_value != c_value { results.record_failed(); eprintln!( - "Constant value mismatch for {}\nRust: {:?}\nC: {:?}", - rust_name, rust_value, &c_value + "Constant value mismatch for {rust_name}\nRust: {rust_value:?}\nC: {c_value:?}", ); continue; } @@ -164,16 +163,13 @@ fn cross_validate_layout_with_c() { { if rust_name != c_name { results.record_failed(); - eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,); + eprintln!("Name mismatch:\nRust: {rust_name:?}\nC: {c_name:?}"); continue; } if rust_layout != c_layout { results.record_failed(); - eprintln!( - "Layout mismatch for {}\nRust: {:?}\nC: {:?}", - rust_name, rust_layout, &c_layout - ); + eprintln!("Layout mismatch for {rust_name}\nRust: {rust_layout:?}\nC: {c_layout:?}",); continue; } @@ -194,7 +190,7 @@ fn get_c_output(name: &str) -> Result> { let mut abi_cmd = Command::new(exe); let output = abi_cmd.output()?; if !output.status.success() { - return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into()); + return Err(format!("command {abi_cmd:?} failed, {output:?}").into()); } Ok(String::from_utf8(output.stdout)?) diff --git a/graphene/sys/versions.txt b/graphene/sys/versions.txt index 2de31b181f59..74cd19185a07 100644 --- a/graphene/sys/versions.txt +++ b/graphene/sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ f92952f3f7ea) +Generated by gir (https://github.com/gtk-rs/gir @ e79806af2905) from gir-files (https://github.com/gtk-rs/gir-files @ 89a11aa6a362) diff --git a/pango/src/auto/versions.txt b/pango/src/auto/versions.txt index 2de31b181f59..74cd19185a07 100644 --- a/pango/src/auto/versions.txt +++ b/pango/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ f92952f3f7ea) +Generated by gir (https://github.com/gtk-rs/gir @ e79806af2905) from gir-files (https://github.com/gtk-rs/gir-files @ 89a11aa6a362) diff --git a/pango/sys/tests/abi.rs b/pango/sys/tests/abi.rs index 79d7aa7cbc63..03e86a98615d 100644 --- a/pango/sys/tests/abi.rs +++ b/pango/sys/tests/abi.rs @@ -40,7 +40,7 @@ impl Compiler { cmd.arg(out); let status = cmd.spawn()?.wait()?; if !status.success() { - return Err(format!("compilation command {:?} failed, {}", &cmd, status).into()); + return Err(format!("compilation command {cmd:?} failed, {status}").into()); } Ok(()) } @@ -56,7 +56,7 @@ fn get_var(name: &str, default: &str) -> Result, Box> { match env::var(name) { Ok(value) => Ok(shell_words::split(&value)?), Err(env::VarError::NotPresent) => Ok(shell_words::split(default)?), - Err(err) => Err(format!("{} {}", name, err).into()), + Err(err) => Err(format!("{name} {err}").into()), } } @@ -70,7 +70,7 @@ fn pkg_config_cflags(packages: &[&str]) -> Result, Box> { cmd.args(packages); let out = cmd.output()?; if !out.status.success() { - return Err(format!("command {:?} returned {}", &cmd, out.status).into()); + return Err(format!("command {cmd:?} returned {}", out.status).into()); } let stdout = str::from_utf8(&out.stdout)?; Ok(shell_words::split(stdout.trim())?) @@ -126,15 +126,14 @@ fn cross_validate_constants_with_c() { { if rust_name != c_name { results.record_failed(); - eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,); + eprintln!("Name mismatch:\nRust: {rust_name:?}\nC: {c_name:?}"); continue; } if rust_value != c_value { results.record_failed(); eprintln!( - "Constant value mismatch for {}\nRust: {:?}\nC: {:?}", - rust_name, rust_value, &c_value + "Constant value mismatch for {rust_name}\nRust: {rust_value:?}\nC: {c_value:?}", ); continue; } @@ -164,16 +163,13 @@ fn cross_validate_layout_with_c() { { if rust_name != c_name { results.record_failed(); - eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,); + eprintln!("Name mismatch:\nRust: {rust_name:?}\nC: {c_name:?}"); continue; } if rust_layout != c_layout { results.record_failed(); - eprintln!( - "Layout mismatch for {}\nRust: {:?}\nC: {:?}", - rust_name, rust_layout, &c_layout - ); + eprintln!("Layout mismatch for {rust_name}\nRust: {rust_layout:?}\nC: {c_layout:?}",); continue; } @@ -194,7 +190,7 @@ fn get_c_output(name: &str) -> Result> { let mut abi_cmd = Command::new(exe); let output = abi_cmd.output()?; if !output.status.success() { - return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into()); + return Err(format!("command {abi_cmd:?} failed, {output:?}").into()); } Ok(String::from_utf8(output.stdout)?) diff --git a/pango/sys/versions.txt b/pango/sys/versions.txt index 2de31b181f59..74cd19185a07 100644 --- a/pango/sys/versions.txt +++ b/pango/sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ f92952f3f7ea) +Generated by gir (https://github.com/gtk-rs/gir @ e79806af2905) from gir-files (https://github.com/gtk-rs/gir-files @ 89a11aa6a362) diff --git a/pangocairo/src/auto/versions.txt b/pangocairo/src/auto/versions.txt index 2de31b181f59..74cd19185a07 100644 --- a/pangocairo/src/auto/versions.txt +++ b/pangocairo/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ f92952f3f7ea) +Generated by gir (https://github.com/gtk-rs/gir @ e79806af2905) from gir-files (https://github.com/gtk-rs/gir-files @ 89a11aa6a362) diff --git a/pangocairo/sys/versions.txt b/pangocairo/sys/versions.txt index 2de31b181f59..74cd19185a07 100644 --- a/pangocairo/sys/versions.txt +++ b/pangocairo/sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ f92952f3f7ea) +Generated by gir (https://github.com/gtk-rs/gir @ e79806af2905) from gir-files (https://github.com/gtk-rs/gir-files @ 89a11aa6a362) From 1c4c0fe52ac83d65c7254ac97e05b79808885997 Mon Sep 17 00:00:00 2001 From: Jason Francis Date: Thu, 3 Nov 2022 23:45:34 -0500 Subject: [PATCH 4/6] glib: fix more clippy lints for rust 1.66 --- glib/src/translate.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/glib/src/translate.rs b/glib/src/translate.rs index 5d696e9aabd1..d9825e4c7873 100644 --- a/glib/src/translate.rs +++ b/glib/src/translate.rs @@ -2578,7 +2578,7 @@ mod tests { FileTest::EXISTS | FileTest::IS_DIR )); assert!(crate::file_test( - &dir_1.canonicalize().unwrap(), + dir_1.canonicalize().unwrap(), FileTest::EXISTS | FileTest::IS_DIR )); @@ -2602,7 +2602,7 @@ mod tests { FileTest::EXISTS | FileTest::IS_DIR )); assert!(crate::file_test( - &dir_2.canonicalize().unwrap(), + dir_2.canonicalize().unwrap(), FileTest::EXISTS | FileTest::IS_DIR )); } @@ -2663,6 +2663,7 @@ mod tests { impl TryFromGlib for SpecialU32 { type Error = GlibNoneError; + #[allow(clippy::unnecessary_cast)] unsafe fn try_from_glib(val: libc::c_uint) -> Result { if val == SpecialU32::GLIB_NONE { return Err(GlibNoneError); From e54d65d20e992ea179a67b72005d09b1e96db0c9 Mon Sep 17 00:00:00 2001 From: Jason Francis Date: Fri, 4 Nov 2022 00:51:14 -0500 Subject: [PATCH 5/6] glib: update compiletest output errors for rust 1.65 --- .../subclass_compiletest/02-no-auto-send-sync.stderr | 2 +- .../03-object-no-auto-send-sync.stderr | 4 ++-- .../05-no-auto-send-sync-with-non-send-sync-parent.stderr | 4 ++-- ...no-auto-send-sync-with-non-send-sync-ffi-parent.stderr | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/glib/tests/subclass_compiletest/02-no-auto-send-sync.stderr b/glib/tests/subclass_compiletest/02-no-auto-send-sync.stderr index 13e4c8771186..bf463b53e3f5 100644 --- a/glib/tests/subclass_compiletest/02-no-auto-send-sync.stderr +++ b/glib/tests/subclass_compiletest/02-no-auto-send-sync.stderr @@ -12,7 +12,7 @@ note: required because it appears within the type `imp::TestObject` | 6 | pub struct TestObject { | ^^^^^^^^^^ - = note: required because of the requirements on the impl of `Send` for `TypedObjectRef` + = note: required for `TypedObjectRef` to implement `Send` note: required because it appears within the type `TestObject` --> tests/subclass_compiletest/02-no-auto-send-sync.rs:20:16 | diff --git a/glib/tests/subclass_compiletest/03-object-no-auto-send-sync.stderr b/glib/tests/subclass_compiletest/03-object-no-auto-send-sync.stderr index 4b8b43ad455e..6a3d82157026 100644 --- a/glib/tests/subclass_compiletest/03-object-no-auto-send-sync.stderr +++ b/glib/tests/subclass_compiletest/03-object-no-auto-send-sync.stderr @@ -7,7 +7,7 @@ error[E0277]: `*mut c_void` cannot be sent between threads safely | required by a bound introduced by this call | = help: the trait `Send` is not implemented for `*mut c_void` - = note: required because of the requirements on the impl of `Send` for `TypedObjectRef<*mut c_void, ()>` + = note: required for `TypedObjectRef<*mut c_void, ()>` to implement `Send` = note: required because it appears within the type `Object` note: required by a bound in `main::check` --> tests/subclass_compiletest/03-object-no-auto-send-sync.rs:2:17 @@ -24,7 +24,7 @@ error[E0277]: `*mut c_void` cannot be shared between threads safely | required by a bound introduced by this call | = help: the trait `Sync` is not implemented for `*mut c_void` - = note: required because of the requirements on the impl of `Send` for `TypedObjectRef<*mut c_void, ()>` + = note: required for `TypedObjectRef<*mut c_void, ()>` to implement `Send` = note: required because it appears within the type `Object` note: required by a bound in `main::check` --> tests/subclass_compiletest/03-object-no-auto-send-sync.rs:2:17 diff --git a/glib/tests/subclass_compiletest/05-no-auto-send-sync-with-non-send-sync-parent.stderr b/glib/tests/subclass_compiletest/05-no-auto-send-sync-with-non-send-sync-parent.stderr index 5bfc89acbd42..86aa355bc603 100644 --- a/glib/tests/subclass_compiletest/05-no-auto-send-sync-with-non-send-sync-parent.stderr +++ b/glib/tests/subclass_compiletest/05-no-auto-send-sync-with-non-send-sync-parent.stderr @@ -12,13 +12,13 @@ note: required because it appears within the type `imp_parent::TestParent` | 6 | pub struct TestParent { | ^^^^^^^^^^ - = note: required because of the requirements on the impl of `Send` for `TypedObjectRef` + = note: required for `TypedObjectRef` to implement `Send` note: required because it appears within the type `TestParent` --> tests/subclass_compiletest/05-no-auto-send-sync-with-non-send-sync-parent.rs:20:16 | 20 | pub struct TestParent(ObjectSubclass); | ^^^^^^^^^^ - = note: required because of the requirements on the impl of `Send` for `TypedObjectRef` + = note: required for `TypedObjectRef` to implement `Send` note: required because it appears within the type `TestObject` --> tests/subclass_compiletest/05-no-auto-send-sync-with-non-send-sync-parent.rs:53:16 | diff --git a/glib/tests/subclass_compiletest/06-no-auto-send-sync-with-non-send-sync-ffi-parent.stderr b/glib/tests/subclass_compiletest/06-no-auto-send-sync-with-non-send-sync-ffi-parent.stderr index a5abf5eb3d05..24aca44fb85c 100644 --- a/glib/tests/subclass_compiletest/06-no-auto-send-sync-with-non-send-sync-ffi-parent.stderr +++ b/glib/tests/subclass_compiletest/06-no-auto-send-sync-with-non-send-sync-ffi-parent.stderr @@ -7,13 +7,13 @@ error[E0277]: `*mut c_void` cannot be sent between threads safely | required by a bound introduced by this call | = help: the trait `Send` is not implemented for `*mut c_void` - = note: required because of the requirements on the impl of `Send` for `TypedObjectRef<*mut c_void, ()>` + = note: required for `TypedObjectRef<*mut c_void, ()>` to implement `Send` note: required because it appears within the type `InitiallyUnowned` --> tests/subclass_compiletest/06-no-auto-send-sync-with-non-send-sync-ffi-parent.rs:3:16 | 3 | pub struct InitiallyUnowned(Object); | ^^^^^^^^^^^^^^^^ - = note: required because of the requirements on the impl of `Send` for `TypedObjectRef` + = note: required for `TypedObjectRef` to implement `Send` note: required because it appears within the type `TestObject` --> tests/subclass_compiletest/06-no-auto-send-sync-with-non-send-sync-ffi-parent.rs:37:16 | @@ -34,13 +34,13 @@ error[E0277]: `*mut c_void` cannot be shared between threads safely | required by a bound introduced by this call | = help: the trait `Sync` is not implemented for `*mut c_void` - = note: required because of the requirements on the impl of `Send` for `TypedObjectRef<*mut c_void, ()>` + = note: required for `TypedObjectRef<*mut c_void, ()>` to implement `Send` note: required because it appears within the type `InitiallyUnowned` --> tests/subclass_compiletest/06-no-auto-send-sync-with-non-send-sync-ffi-parent.rs:3:16 | 3 | pub struct InitiallyUnowned(Object); | ^^^^^^^^^^^^^^^^ - = note: required because of the requirements on the impl of `Send` for `TypedObjectRef` + = note: required for `TypedObjectRef` to implement `Send` note: required because it appears within the type `TestObject` --> tests/subclass_compiletest/06-no-auto-send-sync-with-non-send-sync-ffi-parent.rs:37:16 | From f7c0406c0547b09fb61b5549d56a659e3ad8fc25 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Wed, 9 Nov 2022 16:08:48 +0100 Subject: [PATCH 6/6] Fix new clippy lints --- gdk-pixbuf/tests/check_gir.rs | 2 +- gio/tests/check_gir.rs | 2 +- glib-macros/tests/clone.rs | 4 +-- glib/src/gstring_builder.rs | 2 +- glib/tests/check_gir.rs | 2 +- glib/tests/clone.rs | 66 +++++++++++++++++------------------ glib/tests/structured_log.rs | 2 +- graphene/tests/check_gir.rs | 2 +- pango/src/glyph_string.rs | 2 +- pango/tests/check_gir.rs | 2 +- pangocairo/tests/check_gir.rs | 2 +- 11 files changed, 44 insertions(+), 44 deletions(-) diff --git a/gdk-pixbuf/tests/check_gir.rs b/gdk-pixbuf/tests/check_gir.rs index b095c0444d49..2ccf5ff05bcf 100644 --- a/gdk-pixbuf/tests/check_gir.rs +++ b/gdk-pixbuf/tests/check_gir.rs @@ -3,6 +3,6 @@ #[test] fn check_gir_file() { let res = gir_format_check::check_gir_file("Gir.toml"); - println!("{}", res); + println!("{res}"); assert_eq!(res.nb_errors, 0); } diff --git a/gio/tests/check_gir.rs b/gio/tests/check_gir.rs index b095c0444d49..2ccf5ff05bcf 100644 --- a/gio/tests/check_gir.rs +++ b/gio/tests/check_gir.rs @@ -3,6 +3,6 @@ #[test] fn check_gir_file() { let res = gir_format_check::check_gir_file("Gir.toml"); - println!("{}", res); + println!("{res}"); assert_eq!(res.nb_errors, 0); } diff --git a/glib-macros/tests/clone.rs b/glib-macros/tests/clone.rs index 6b6bad3dfdf0..55b73a490832 100644 --- a/glib-macros/tests/clone.rs +++ b/glib-macros/tests/clone.rs @@ -84,8 +84,8 @@ fn clone_failures() { for (index, (expr, err)) in TESTS.iter().enumerate() { let prefix = "fn main() { use glib::clone; let v = std::rc::Rc::new(1); "; let suffix = "; }"; - let output = format!("{}{}{}", prefix, expr, suffix); + let output = format!("{prefix}{expr}{suffix}"); - t.compile_fail_inline_check_sub(&format!("test_{}", index), &output, err); + t.compile_fail_inline_check_sub(&format!("test_{index}"), &output, err); } } diff --git a/glib/src/gstring_builder.rs b/glib/src/gstring_builder.rs index 3880dcba9ecf..b7a9449c13e7 100644 --- a/glib/src/gstring_builder.rs +++ b/glib/src/gstring_builder.rs @@ -248,7 +248,7 @@ mod tests { #[test] fn display() { let s: crate::GStringBuilder = crate::GStringBuilder::new("This is a string."); - assert_eq!(&format!("{}", s), "This is a string."); + assert_eq!(&format!("{s}"), "This is a string."); } #[test] diff --git a/glib/tests/check_gir.rs b/glib/tests/check_gir.rs index b095c0444d49..2ccf5ff05bcf 100644 --- a/glib/tests/check_gir.rs +++ b/glib/tests/check_gir.rs @@ -3,6 +3,6 @@ #[test] fn check_gir_file() { let res = gir_format_check::check_gir_file("Gir.toml"); - println!("{}", res); + println!("{res}"); assert_eq!(res.nb_errors, 0); } diff --git a/glib/tests/clone.rs b/glib/tests/clone.rs index 4bd2950607de..c0d09d70f50f 100644 --- a/glib/tests/clone.rs +++ b/glib/tests/clone.rs @@ -48,7 +48,7 @@ fn subfields_renaming() { let state = Rc::new(RefCell::new(State::new())); let closure = clone!(@strong self.v as v, @weak state as hello => move |_| { - println!("v: {}", v); + println!("v: {v}"); hello.borrow_mut().started = true; }); closure(2); @@ -182,29 +182,29 @@ fn test_clone_macro_self_rename() { #[allow(dead_code)] fn foo(&self) { let closure = clone!(@strong self as this => move |_x| { - println!("v: {:?}", this); + println!("v: {this:?}"); }); closure(0i8); // to prevent compiler error for unknown `x` type. let _ = clone!(@strong self as this => move || { - println!("v: {:?}", this); + println!("v: {this:?}"); }); - let closure = clone!(@strong self as this => move |_x| println!("v: {:?}", this)); + let closure = clone!(@strong self as this => move |_x| println!("v: {this:?}")); closure(0i8); // to prevent compiler error for unknown `x` type. - let _ = clone!(@strong self as this => move || println!("v: {:?}", this)); + let _ = clone!(@strong self as this => move || println!("v: {this:?}")); // Fields now! let closure = clone!(@strong self.v as v => move |_x| { - println!("v: {:?}", v); + println!("v: {v:?}"); }); closure(0i8); // to prevent compiler error for unknown `x` type. - let _ = clone!(@strong self.v as v => move || println!("v: {:?}", v)); + let _ = clone!(@strong self.v as v => move || println!("v: {v:?}")); // With @default-panic let closure = clone!(@strong self.v as v => @default-panic, move |_x| { - println!("v: {:?}", v); + println!("v: {v:?}"); }); closure(0i8); // to prevent compiler error for unknown `x` type. - let _ = clone!(@strong self.v as v => @default-panic, move || println!("v: {:?}", v)); + let _ = clone!(@strong self.v as v => @default-panic, move || println!("v: {v:?}")); // With @default-return let closure = clone!(@strong self.v as _v => @default-return true, move |_x| { @@ -221,28 +221,28 @@ fn test_clone_macro_rename() { let v = Rc::new(1); let closure = clone!(@weak v as y => @default-panic, move |_x| { - println!("v: {}", y); + println!("v: {y}"); }); closure(0i8); // to prevent compiler error for unknown `x` type. - let _ = clone!(@weak v as y => @default-panic, move || println!("v: {}", y)); + let _ = clone!(@weak v as y => @default-panic, move || println!("v: {y}")); let closure = clone!(@strong v as y => @default-panic, move |_x| { - println!("v: {}", y); + println!("v: {y}"); }); closure(0i8); // to prevent compiler error for unknown `x` type. - let _ = clone!(@strong v as y => @default-panic, move || println!("v: {}", y)); + let _ = clone!(@strong v as y => @default-panic, move || println!("v: {y}")); let closure = clone!(@weak v as y => move |_x| { - println!("v: {}", y); + println!("v: {y}"); }); closure(0i8); // to prevent compiler error for unknown `x` type. - let _ = clone!(@weak v as y => move || println!("v: {}", y)); + let _ = clone!(@weak v as y => move || println!("v: {y}")); let closure = clone!(@strong v as y => move |_x| { - println!("v: {}", y); + println!("v: {y}"); }); closure(0i8); // to prevent compiler error for unknown `x` type. - let _ = clone!(@strong v as y => move || println!("v: {}", y)); + let _ = clone!(@strong v as y => move || println!("v: {y}")); let closure = clone!(@weak v as _y => @default-return true, move |_x| { false @@ -260,28 +260,28 @@ fn test_clone_macro_simple() { let v = Rc::new(1); let closure = clone!(@weak v => @default-panic, move |_x| { - println!("v: {}", v); + println!("v: {v}"); }); closure(0i8); // to prevent compiler error for unknown `x` type. - let _ = clone!(@weak v => @default-panic, move || println!("v: {}", v)); + let _ = clone!(@weak v => @default-panic, move || println!("v: {v}")); let closure = clone!(@strong v => @default-panic, move |_x| { - println!("v: {}", v); + println!("v: {v}"); }); closure(0i8); // to prevent compiler error for unknown `x` type. - let _ = clone!(@strong v => @default-panic, move || println!("v: {}", v)); + let _ = clone!(@strong v => @default-panic, move || println!("v: {v}")); let closure = clone!(@weak v => move |_x| { - println!("v: {}", v); + println!("v: {v}"); }); closure(0i8); // to prevent compiler error for unknown `x` type. - let _ = clone!(@weak v => move || println!("v: {}", v)); + let _ = clone!(@weak v => move || println!("v: {v}")); let closure = clone!(@strong v => move |_x| { - println!("v: {}", v); + println!("v: {v}"); }); closure(0i8); // to prevent compiler error for unknown `x` type. - let _ = clone!(@strong v => move || println!("v: {}", v)); + let _ = clone!(@strong v => move || println!("v: {v}")); let closure = clone!(@weak v => @default-return true, move |_x| { false @@ -300,28 +300,28 @@ fn test_clone_macro_double_simple() { let w = Rc::new(2); let closure = clone!(@weak v, @weak w => @default-panic, move |_x| { - println!("v: {}, w: {}", v, w); + println!("v: {v}, w: {w}"); }); closure(0i8); // to prevent compiler error for unknown `x` type. - let _ = clone!(@weak v, @weak w => @default-panic, move || println!("v: {}, w: {}", v, w)); + let _ = clone!(@weak v, @weak w => @default-panic, move || println!("v: {v}, w: {w}")); let closure = clone!(@strong v, @strong w => @default-panic, move |_x| { - println!("v: {}, w: {}", v, w); + println!("v: {v}, w: {w}"); }); closure(0i8); // to prevent compiler error for unknown `x` type. - let _ = clone!(@strong v, @strong w => @default-panic, move || println!("v: {}, w: {}", v, w)); + let _ = clone!(@strong v, @strong w => @default-panic, move || println!("v: {v}, w: {w}")); let closure = clone!(@weak v, @weak w => move |_x| { - println!("v: {}, w: {}", v, w); + println!("v: {v}, w: {w}"); }); closure(0i8); // to prevent compiler error for unknown `x` type. - let _ = clone!(@weak v, @weak w => move || println!("v: {}, w: {}", v, w)); + let _ = clone!(@weak v, @weak w => move || println!("v: {v}, w: {w}")); let closure = clone!(@strong v, @strong w => move |_x| { - println!("v: {}, w: {}", v, w); + println!("v: {v}, w: {w}"); }); closure(0i8); // to prevent compiler error for unknown `x` type. - let _ = clone!(@strong v, @strong w => move || println!("v: {}, w: {}", v, w)); + let _ = clone!(@strong v, @strong w => move || println!("v: {v}, w: {w}")); let closure = clone!(@weak v, @weak w => @default-return true, move |_x| { false diff --git a/glib/tests/structured_log.rs b/glib/tests/structured_log.rs index 7b9a0003c6d5..e0d57dac4aa5 100644 --- a/glib/tests/structured_log.rs +++ b/glib/tests/structured_log.rs @@ -16,7 +16,7 @@ fn structured_log() { .map(|f| { let value = if let Some(data) = f.user_data() { assert!(f.value_str().is_none()); - format!("USERDATA: {}", data) + format!("USERDATA: {data}") } else { f.value_str().unwrap().to_owned() }; diff --git a/graphene/tests/check_gir.rs b/graphene/tests/check_gir.rs index b095c0444d49..2ccf5ff05bcf 100644 --- a/graphene/tests/check_gir.rs +++ b/graphene/tests/check_gir.rs @@ -3,6 +3,6 @@ #[test] fn check_gir_file() { let res = gir_format_check::check_gir_file("Gir.toml"); - println!("{}", res); + println!("{res}"); assert_eq!(res.nb_errors, 0); } diff --git a/pango/src/glyph_string.rs b/pango/src/glyph_string.rs index fa90c5aa1a37..2cda8a51fc33 100644 --- a/pango/src/glyph_string.rs +++ b/pango/src/glyph_string.rs @@ -73,6 +73,6 @@ mod tests { s.log_clusters_mut()[i] = i as i32; } let widths = s.logical_widths(TXT, false); - println!("{:?}", widths); + println!("{widths:?}"); } } diff --git a/pango/tests/check_gir.rs b/pango/tests/check_gir.rs index b095c0444d49..2ccf5ff05bcf 100644 --- a/pango/tests/check_gir.rs +++ b/pango/tests/check_gir.rs @@ -3,6 +3,6 @@ #[test] fn check_gir_file() { let res = gir_format_check::check_gir_file("Gir.toml"); - println!("{}", res); + println!("{res}"); assert_eq!(res.nb_errors, 0); } diff --git a/pangocairo/tests/check_gir.rs b/pangocairo/tests/check_gir.rs index b095c0444d49..2ccf5ff05bcf 100644 --- a/pangocairo/tests/check_gir.rs +++ b/pangocairo/tests/check_gir.rs @@ -3,6 +3,6 @@ #[test] fn check_gir_file() { let res = gir_format_check::check_gir_file("Gir.toml"); - println!("{}", res); + println!("{res}"); assert_eq!(res.nb_errors, 0); }