Skip to content

Commit d73d5f7

Browse files
Fix clippy lints
1 parent eadff1a commit d73d5f7

File tree

7 files changed

+15
-23
lines changed

7 files changed

+15
-23
lines changed

gio/src/file.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ impl<O: IsA<File>> FileExtManual for O {
537537
slice::from_raw_parts(file_contents as *const u8, file_size as usize)
538538
};
539539

540-
(&mut *callback.1.borrow_mut().get_mut())(data).into_glib()
540+
(*callback.1.borrow_mut().get_mut())(data).into_glib()
541541
}
542542

543543
let user_data = Box::into_raw(user_data) as *mut _;
@@ -573,7 +573,7 @@ impl<O: IsA<File>> FileExtManual for O {
573573
let callback: &Option<RefCell<Box<dyn Fn(bool, u64, u64, u64) + 'static>>> =
574574
&*(user_data as *mut _);
575575
if let Some(ref callback) = *callback {
576-
(&mut *callback.borrow_mut())(reporting, current_size, num_dirs, num_files)
576+
(*callback.borrow_mut())(reporting, current_size, num_dirs, num_files)
577577
} else {
578578
panic!("cannot get closure...")
579579
};

gio/src/pollable_input_stream.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,7 @@ impl<O: IsA<PollableInputStream>> PollableInputStreamExtManual for O {
8080
) -> glib::ffi::gboolean {
8181
let func: &RefCell<F> = &*(func as *const RefCell<F>);
8282
let mut func = func.borrow_mut();
83-
(&mut *func)(PollableInputStream::from_glib_borrow(stream).unsafe_cast_ref())
84-
.into_glib()
83+
(*func)(PollableInputStream::from_glib_borrow(stream).unsafe_cast_ref()).into_glib()
8584
}
8685
unsafe extern "C" fn destroy_closure<O, F>(ptr: glib::ffi::gpointer) {
8786
Box::<RefCell<F>>::from_raw(ptr as *mut _);

gio/src/pollable_output_stream.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ impl<O: IsA<PollableOutputStream>> PollableOutputStreamExtManual for O {
7575
) -> glib::ffi::gboolean {
7676
let func: &RefCell<F> = &*(func as *const RefCell<F>);
7777
let mut func = func.borrow_mut();
78-
(&mut *func)(PollableOutputStream::from_glib_borrow(stream).unsafe_cast_ref())
79-
.into_glib()
78+
(*func)(PollableOutputStream::from_glib_borrow(stream).unsafe_cast_ref()).into_glib()
8079
}
8180
unsafe extern "C" fn destroy_closure<O, F>(ptr: glib::ffi::gpointer) {
8281
Box::<RefCell<F>>::from_raw(ptr as *mut _);

gio/src/socket.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ impl<O: IsA<Socket>> SocketExtManual for O {
355355
) -> glib::ffi::gboolean {
356356
let func: &RefCell<F> = &*(func as *const RefCell<F>);
357357
let mut func = func.borrow_mut();
358-
(&mut *func)(
358+
(*func)(
359359
Socket::from_glib_borrow(socket).unsafe_cast_ref(),
360360
from_glib(condition),
361361
)

glib/src/object.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ impl fmt::Debug for ObjectRef {
322322
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
323323
let type_ = unsafe {
324324
let klass = (*self.inner.as_ptr()).g_type_instance.g_class as *const ObjectClass;
325-
(&*klass).type_()
325+
(*klass).type_()
326326
};
327327

328328
f.debug_struct("ObjectRef")

glib/src/source.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,14 @@ unsafe extern "C" fn trampoline<F: FnMut() -> Continue + Send + 'static>(
109109
func: gpointer,
110110
) -> gboolean {
111111
let func: &RefCell<F> = &*(func as *const RefCell<F>);
112-
(&mut *func.borrow_mut())().into_glib()
112+
(*func.borrow_mut())().into_glib()
113113
}
114114

115115
unsafe extern "C" fn trampoline_local<F: FnMut() -> Continue + 'static>(
116116
func: gpointer,
117117
) -> gboolean {
118118
let func: &ThreadGuard<RefCell<F>> = &*(func as *const ThreadGuard<RefCell<F>>);
119-
(&mut *func.get_ref().borrow_mut())().into_glib()
119+
(*func.get_ref().borrow_mut())().into_glib()
120120
}
121121

122122
unsafe extern "C" fn destroy_closure<F: FnMut() -> Continue + Send + 'static>(ptr: gpointer) {
@@ -143,7 +143,7 @@ unsafe extern "C" fn trampoline_child_watch<F: FnMut(Pid, i32) + Send + 'static>
143143
func: gpointer,
144144
) {
145145
let func: &RefCell<F> = &*(func as *const RefCell<F>);
146-
(&mut *func.borrow_mut())(Pid(pid), status)
146+
(*func.borrow_mut())(Pid(pid), status)
147147
}
148148

149149
unsafe extern "C" fn trampoline_child_watch_local<F: FnMut(Pid, i32) + 'static>(
@@ -152,7 +152,7 @@ unsafe extern "C" fn trampoline_child_watch_local<F: FnMut(Pid, i32) + 'static>(
152152
func: gpointer,
153153
) {
154154
let func: &ThreadGuard<RefCell<F>> = &*(func as *const ThreadGuard<RefCell<F>>);
155-
(&mut *func.get_ref().borrow_mut())(Pid(pid), status)
155+
(*func.get_ref().borrow_mut())(Pid(pid), status)
156156
}
157157

158158
unsafe extern "C" fn destroy_closure_child_watch<F: FnMut(Pid, i32) + Send + 'static>(
@@ -187,7 +187,7 @@ unsafe extern "C" fn trampoline_unix_fd<
187187
func: gpointer,
188188
) -> gboolean {
189189
let func: &RefCell<F> = &*(func as *const RefCell<F>);
190-
(&mut *func.borrow_mut())(fd, from_glib(condition)).into_glib()
190+
(*func.borrow_mut())(fd, from_glib(condition)).into_glib()
191191
}
192192

193193
#[cfg(any(unix, feature = "dox"))]
@@ -200,7 +200,7 @@ unsafe extern "C" fn trampoline_unix_fd_local<
200200
func: gpointer,
201201
) -> gboolean {
202202
let func: &ThreadGuard<RefCell<F>> = &*(func as *const ThreadGuard<RefCell<F>>);
203-
(&mut *func.get_ref().borrow_mut())(fd, from_glib(condition)).into_glib()
203+
(*func.get_ref().borrow_mut())(fd, from_glib(condition)).into_glib()
204204
}
205205

206206
#[cfg(any(unix, feature = "dox"))]

glib/src/variant.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@ impl Variant {
650650
unsafe {
651651
let data = Box::new(data);
652652
let (data_ptr, len) = {
653-
let data = (&*data).as_ref();
653+
let data = (*data).as_ref();
654654
(data.as_ptr(), data.len())
655655
};
656656

@@ -685,7 +685,7 @@ impl Variant {
685685
pub unsafe fn from_data_with_type_trusted<A: AsRef<[u8]>>(data: A, type_: &VariantTy) -> Self {
686686
let data = Box::new(data);
687687
let (data_ptr, len) = {
688-
let data = (&*data).as_ref();
688+
let data = (*data).as_ref();
689689
(data.as_ptr(), data.len())
690690
};
691691

@@ -1572,13 +1572,7 @@ where
15721572
}
15731573

15741574
let mut builder = crate::GStringBuilder::default();
1575-
write!(
1576-
&mut builder,
1577-
"a{{{}{}}}",
1578-
key_type.as_str(),
1579-
value_type.as_str()
1580-
)
1581-
.unwrap();
1575+
write!(builder, "a{{{}{}}}", key_type.as_str(), value_type.as_str()).unwrap();
15821576

15831577
Cow::Owned(VariantType::from_string(builder.into_string()).unwrap())
15841578
}

0 commit comments

Comments
 (0)