Skip to content

Commit a4ecbbc

Browse files
authored
Merge pull request #1085 from sdroege/clippy-1.69
Fix various new Rust 1.69 clippy warnings
2 parents 0bac0df + 8e9655a commit a4ecbbc

File tree

6 files changed

+17
-17
lines changed

6 files changed

+17
-17
lines changed

gio/src/desktop_app_info.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,21 +86,19 @@ impl<O: IsA<DesktopAppInfo>> DesktopAppInfoExtManual for O {
8686
stderr_fd: &mut V,
8787
) -> Result<(), Error> {
8888
let user_setup_data: Box_<Option<Box_<dyn FnOnce() + 'static>>> = Box_::new(user_setup);
89-
unsafe extern "C" fn user_setup_func<P: IsA<AppLaunchContext>>(
90-
user_data: glib::ffi::gpointer,
91-
) {
89+
unsafe extern "C" fn user_setup_func(user_data: glib::ffi::gpointer) {
9290
let callback: Box_<Option<Box_<dyn FnOnce() + 'static>>> =
9391
Box_::from_raw(user_data as *mut _);
9492
let callback = (*callback).expect("cannot get closure...");
9593
callback()
9694
}
9795
let user_setup = if user_setup_data.is_some() {
98-
Some(user_setup_func::<P> as _)
96+
Some(user_setup_func as _)
9997
} else {
10098
None
10199
};
102100
let pid_callback_data: Option<&mut dyn (FnMut(&DesktopAppInfo, glib::Pid))> = pid_callback;
103-
unsafe extern "C" fn pid_callback_func<P: IsA<AppLaunchContext>>(
101+
unsafe extern "C" fn pid_callback_func(
104102
appinfo: *mut ffi::GDesktopAppInfo,
105103
pid: glib::ffi::GPid,
106104
user_data: glib::ffi::gpointer,
@@ -117,7 +115,7 @@ impl<O: IsA<DesktopAppInfo>> DesktopAppInfoExtManual for O {
117115
};
118116
}
119117
let pid_callback = if pid_callback_data.is_some() {
120-
Some(pid_callback_func::<P> as _)
118+
Some(pid_callback_func as _)
121119
} else {
122120
None
123121
};

glib-macros/tests/properties.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,8 +388,8 @@ fn props() {
388388
#[cfg(test)]
389389
mod kw_names {
390390
mod imp {
391-
use glib::subclass::types::ObjectSubclassExt;
392-
use glib::subclass::{object::DerivedObjectProperties, prelude::ObjectImplExt};
391+
392+
use glib::subclass::object::DerivedObjectProperties;
393393
use glib::ObjectExt;
394394
use std::cell::Cell;
395395

glib-macros/tests/value_delegate_derive.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ fn into_value() {
3737
test_func(&TestManualFrom(123));
3838
test_func(TestManualFrom(123));
3939

40-
test_func(&TestNullable("foo".to_string()));
40+
test_func(TestNullable("foo".to_string()));
4141
test_func(TestNullable("foo".to_string()));
4242
test_func(Some(&TestNullable("foo".to_string())));
43-
test_func(&Some(TestNullable("foo".to_string())));
43+
test_func(Some(TestNullable("foo".to_string())));
4444
test_func(Some(TestNullable("foo".to_string())));
4545

4646
assert_eq!(glib::Value::from(Test(123)).get::<Test>().unwrap().0, 123);
@@ -149,7 +149,7 @@ fn higher_level_types() {
149149
}
150150
impl<'a> From<&'a MyVecManualFrom> for Option<String> {
151151
fn from(v: &'a MyVecManualFrom) -> Self {
152-
v.0.iter().next().cloned()
152+
v.0.first().cloned()
153153
}
154154
}
155155
impl From<MyVecManualFrom> for Option<String> {
@@ -160,7 +160,7 @@ fn higher_level_types() {
160160

161161
let vec = vec!["foo".to_string(), "bar".to_string()];
162162
let vec_value = vec.to_value();
163-
let my_vec_value = MyVec(vec.clone()).to_value();
163+
let my_vec_value = MyVec(vec).to_value();
164164
assert_eq!(MyVec::static_type(), Vec::<String>::static_type());
165165
assert_eq!(
166166
vec_value.get::<Vec<String>>().unwrap(),

glib/src/subclass/object.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ mod test {
567567
);
568568

569569
assert_eq!(obj.property::<String>("name"), String::from("initial"));
570-
obj.set_property("name", &"test");
570+
obj.set_property("name", "test");
571571
assert_eq!(obj.property::<String>("name"), String::from("test"));
572572

573573
let child = Object::with_type(ChildObject::static_type());
@@ -582,7 +582,7 @@ mod test {
582582
.property("name", "initial")
583583
.build();
584584

585-
obj.set_property("construct-name", &"test");
585+
obj.set_property("construct-name", "test");
586586
}
587587

588588
#[test]
@@ -593,7 +593,7 @@ mod test {
593593
.property("name", "initial")
594594
.build();
595595

596-
obj.set_property("test", &true);
596+
obj.set_property("test", true);
597597
}
598598

599599
#[test]
@@ -604,7 +604,7 @@ mod test {
604604
.property("name", "initial")
605605
.build();
606606

607-
obj.set_property("constructed", &false);
607+
obj.set_property("constructed", false);
608608
}
609609

610610
#[test]
@@ -615,7 +615,7 @@ mod test {
615615
.property("name", "initial")
616616
.build();
617617

618-
obj.set_property("name", &false);
618+
obj.set_property("name", false);
619619
}
620620

621621
#[test]

glib/tests/subclass_compiletest/02-no-auto-send-sync.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ error[E0277]: `RefCell<std::string::String>` cannot be shared between threads sa
77
| required by a bound introduced by this call
88
|
99
= help: within `imp::TestObject`, the trait `Sync` is not implemented for `RefCell<std::string::String>`
10+
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
1011
note: required because it appears within the type `TestObject`
1112
--> tests/subclass_compiletest/02-no-auto-send-sync.rs:6:16
1213
|

glib/tests/subclass_compiletest/05-no-auto-send-sync-with-non-send-sync-parent.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ error[E0277]: `RefCell<std::string::String>` cannot be shared between threads sa
77
| required by a bound introduced by this call
88
|
99
= help: within `imp_parent::TestParent`, the trait `Sync` is not implemented for `RefCell<std::string::String>`
10+
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
1011
note: required because it appears within the type `TestParent`
1112
--> tests/subclass_compiletest/05-no-auto-send-sync-with-non-send-sync-parent.rs:6:16
1213
|

0 commit comments

Comments
 (0)