diff --git a/cairo/src/rectangle_int.rs b/cairo/src/rectangle_int.rs index ee79d01c6e2b..c5a7ff1658b7 100644 --- a/cairo/src/rectangle_int.rs +++ b/cairo/src/rectangle_int.rs @@ -27,7 +27,7 @@ impl RectangleInt { self.0.x = x; } pub fn y(&self) -> i32 { - self.0.x + self.0.y } pub fn set_y(&mut self, y: i32) { self.0.y = y; diff --git a/examples/gio_cancellable_future/main.rs b/examples/gio_cancellable_future/main.rs index 3c79a664413d..5c347d456e86 100644 --- a/examples/gio_cancellable_future/main.rs +++ b/examples/gio_cancellable_future/main.rs @@ -41,10 +41,7 @@ fn main() { thread::spawn(move || { thread::sleep(TIMEOUT); - println!( - "Timeout ({:?}) elapsed! Cancelling pending task...", - TIMEOUT - ); + println!("Timeout ({TIMEOUT:?}) elapsed! Cancelling pending task...",); cancellable.cancel(); }); diff --git a/examples/gio_task/file_size/ffi.rs b/examples/gio_task/file_size/ffi.rs index 93e17586fcf1..c8b721066d11 100644 --- a/examples/gio_task/file_size/ffi.rs +++ b/examples/gio_task/file_size/ffi.rs @@ -34,7 +34,7 @@ pub unsafe extern "C" fn my_file_size_get_file_size_async( closure, ); - glib::MainContext::default().spawn_local(async move { + glib::MainContext::ref_thread_default().spawn_local(async move { let size = gio::File::for_path("Cargo.toml") .query_info_future("*", gio::FileQueryInfoFlags::NONE, glib::PRIORITY_DEFAULT) .await diff --git a/examples/gio_task/file_size/mod.rs b/examples/gio_task/file_size/mod.rs index de60c41b4164..4f0ac0101715 100644 --- a/examples/gio_task/file_size/mod.rs +++ b/examples/gio_task/file_size/mod.rs @@ -39,7 +39,7 @@ impl FileSize { ) }; - glib::MainContext::default().spawn_local(async move { + glib::MainContext::ref_thread_default().spawn_local(async move { let size = gio::File::for_path("Cargo.toml") .query_info_future("*", gio::FileQueryInfoFlags::NONE, glib::PRIORITY_DEFAULT) .await diff --git a/examples/gio_task/main.rs b/examples/gio_task/main.rs index a8a9fd4a8e48..e2741724809a 100644 --- a/examples/gio_task/main.rs +++ b/examples/gio_task/main.rs @@ -108,10 +108,7 @@ fn run_in_thread(send: oneshot::Sender<()>) { let cancellable = gio::Cancellable::new(); let closure = move |value: i64, source_object: &FileSize| { - println!( - "Safe callback (threaded version) - Returned value from task: {}", - value - ); + println!("Safe callback (threaded version) - Returned value from task: {value}",); println!( "Safe callback (threaded version) - FileSize::size: {}", source_object.retrieved_size().unwrap() diff --git a/gdk-pixbuf/src/pixbuf.rs b/gdk-pixbuf/src/pixbuf.rs index 516fe6a14bc4..c6fc9d1665cd 100644 --- a/gdk-pixbuf/src/pixbuf.rs +++ b/gdk-pixbuf/src/pixbuf.rs @@ -521,7 +521,7 @@ impl Pixbuf { Box::pin(gio::GioFuture::new(self, move |obj, cancellable, send| { let options = options .iter() - .map(|&(ref k, ref v)| (k.as_str(), v.as_str())) + .map(|(k, v)| (k.as_str(), v.as_str())) .collect::>(); obj.save_to_streamv_async( diff --git a/gio/src/input_stream.rs b/gio/src/input_stream.rs index ec5cf0ecb837..c33b451fdf9c 100644 --- a/gio/src/input_stream.rs +++ b/gio/src/input_stream.rs @@ -531,10 +531,7 @@ impl> InputStreamAsyncBufRead { { let available = j - i; if amt > available { - panic!( - "Cannot consume {} bytes as only {} are available", - amt, available - ) + panic!("Cannot consume {amt} bytes as only {available} are available",) } let remaining = available - amt; if remaining == 0 { diff --git a/glib/src/object.rs b/glib/src/object.rs index ecfd7f4dc9f7..56df99a2214c 100644 --- a/glib/src/object.rs +++ b/glib/src/object.rs @@ -2741,10 +2741,7 @@ impl ObjectExt for T { assert!( type_.is_a(signal_query_type), - "Signal '{}' of type '{}' but got type '{}'", - signal_name, - type_, - signal_query_type + "Signal '{signal_name}' of type '{type_}' but got type '{signal_query_type}'", ); let handler = gobject_ffi::g_signal_connect_closure_by_id( @@ -2790,10 +2787,7 @@ impl ObjectExt for T { let signal_query_type = signal_query.type_(); assert!( type_.is_a(signal_query_type), - "Signal '{}' of type '{}' but got type '{}'", - signal_name, - type_, - signal_query_type + "Signal '{signal_name}' of type '{type_}' but got type '{signal_query_type}'", ); unsafe { diff --git a/glib/src/param_spec.rs b/glib/src/param_spec.rs index 99964f8900c9..329cdda2c389 100644 --- a/glib/src/param_spec.rs +++ b/glib/src/param_spec.rs @@ -721,8 +721,7 @@ macro_rules! define_builder_numeric { fn assert_param_name(name: &str) { assert!( is_canonical_pspec_name(name), - "{} is not a valid canonical parameter name", - name + "{name} is not a valid canonical parameter name", ); } define_param_spec_numeric!( diff --git a/glib/src/subclass/signal.rs b/glib/src/subclass/signal.rs index 8a0ae8a1a670..25ff8e4ded30 100644 --- a/glib/src/subclass/signal.rs +++ b/glib/src/subclass/signal.rs @@ -543,8 +543,7 @@ impl Signal { pub fn builder(name: &str) -> SignalBuilder { assert!( is_canonical_pspec_name(name), - "{} is not a valid canonical signal name", - name + "{name} is not a valid canonical signal name", ); SignalBuilder { name: name.to_owned(), diff --git a/glib/src/subclass/types.rs b/glib/src/subclass/types.rs index 3931edad57c7..8de271073641 100644 --- a/glib/src/subclass/types.rs +++ b/glib/src/subclass/types.rs @@ -468,8 +468,7 @@ impl TypeData { if let Some(ref mut class_data) = self.class_data { assert!( class_data.get(&type_).is_none(), - "The class_data already contains a key for {}", - type_ + "The class_data already contains a key for {type_}", ); class_data.insert(type_, Box::new(data)); @@ -801,8 +800,7 @@ impl InitializingObject { if let Some(ref mut instance_data) = priv_.instance_data { assert!( instance_data.get(&type_).is_none(), - "The class_data already contains a key for {}", - type_ + "The class_data already contains a key for {type_}", ); instance_data.insert(type_, Box::new(data));