From ce605b8233c0120654e7222c254ff51187079d74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Dom=C3=ADnguez?= Date: Wed, 18 Nov 2020 23:37:52 +0100 Subject: [PATCH] Remove Rc> pattern in widgets::members_list --- fractal-gtk/src/widgets/members_list.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/fractal-gtk/src/widgets/members_list.rs b/fractal-gtk/src/widgets/members_list.rs index e6f9933d..9a885bcd 100644 --- a/fractal-gtk/src/widgets/members_list.rs +++ b/fractal-gtk/src/widgets/members_list.rs @@ -1,8 +1,6 @@ use glib::clone; use matrix_sdk::identifiers::UserId; -use std::cell::RefCell; -use std::collections::hash_map::HashMap; -use std::rc::Rc; +use std::{cell::RefCell, collections::hash_map::HashMap}; use glib::signal; use gtk::prelude::*; @@ -69,12 +67,11 @@ impl MembersList { Some(w.get_text().to_string()), ); }); - /* we need to remove the handler when the member list is destroyed */ - let id: Rc>> = Rc::new(RefCell::new(Some(id))); + // We need to remove the handler when the member list is destroyed + let id = RefCell::new(Some(id)); let search_entry = self.search_entry.clone(); self.container.connect_destroy(move |_| { - let id = id.borrow_mut().take(); - if let Some(id) = id { + if let Some(id) = id.borrow_mut().take() { signal::signal_handler_disconnect(&search_entry, id); } });