Use Arc::clone(&val) instead of val.clone() to make it more explicit that only the Arc cloned here

This commit is contained in:
Sebastian Dröge 2017-11-26 23:59:03 +02:00
parent 2b0674b7cb
commit 918b34fb7a
2 changed files with 2 additions and 2 deletions

View file

@ -149,7 +149,7 @@ mod futures {
pub fn new(bus: &Bus) -> Self { pub fn new(bus: &Bus) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
let task = Arc::new(Mutex::new(None)); let task = Arc::new(Mutex::new(None));
let task_clone = task.clone(); let task_clone = Arc::clone(&task);
bus.set_sync_handler(move |_, _| { bus.set_sync_handler(move |_, _| {
let mut task = task_clone.lock().unwrap(); let mut task = task_clone.lock().unwrap();

View file

@ -355,7 +355,7 @@ unsafe extern "C" fn filter_boxed_ref<T: 'static>(boxed: gpointer) -> gpointer {
callback_guard!(); callback_guard!();
let boxed = Arc::from_raw(boxed as *const (Box<Fn(T) -> bool + Send + Sync + 'static>)); let boxed = Arc::from_raw(boxed as *const (Box<Fn(T) -> bool + Send + Sync + 'static>));
let copy = boxed.clone(); let copy = Arc::clone(&boxed);
// Forget it and keep it alive, we will still need it later // Forget it and keep it alive, we will still need it later
let _ = Arc::into_raw(boxed); let _ = Arc::into_raw(boxed);