Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.16 backports #864

Merged
merged 2 commits into from Dec 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion cairo/src/rectangle_int.rs
Expand Up @@ -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;
Expand Down
5 changes: 1 addition & 4 deletions examples/gio_cancellable_future/main.rs
Expand Up @@ -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();
});
Expand Down
2 changes: 1 addition & 1 deletion examples/gio_task/file_size/ffi.rs
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/gio_task/file_size/mod.rs
Expand Up @@ -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
Expand Down
5 changes: 1 addition & 4 deletions examples/gio_task/main.rs
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion gdk-pixbuf/src/pixbuf.rs
Expand Up @@ -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::<Vec<(&str, &str)>>();

obj.save_to_streamv_async(
Expand Down
5 changes: 1 addition & 4 deletions gio/src/input_stream.rs
Expand Up @@ -531,10 +531,7 @@ impl<T: IsA<InputStream>> InputStreamAsyncBufRead<T> {
{
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 {
Expand Down
10 changes: 2 additions & 8 deletions glib/src/object.rs
Expand Up @@ -2741,10 +2741,7 @@ impl<T: ObjectType> 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(
Expand Down Expand Up @@ -2790,10 +2787,7 @@ impl<T: ObjectType> 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 {
Expand Down
3 changes: 1 addition & 2 deletions glib/src/param_spec.rs
Expand Up @@ -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!(
Expand Down
3 changes: 1 addition & 2 deletions glib/src/subclass/signal.rs
Expand Up @@ -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(),
Expand Down
6 changes: 2 additions & 4 deletions glib/src/subclass/types.rs
Expand Up @@ -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));
Expand Down Expand Up @@ -801,8 +800,7 @@ impl<T: ObjectSubclass> InitializingObject<T> {
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));
Expand Down