[fractal] Get rid of "warning: cannot borrow `*self` as mutable"



commit 31f177f5c1473b2247a08a24481ac5dd1a73e937
Author: Federico Mena Quintero <federico gnome org>
Date:   Thu Oct 31 15:33:04 2019 -0600

    Get rid of "warning: cannot borrow `*self` as mutable"
    
    warning: cannot borrow `*self` as mutable because it is also borrowed as immutable
       --> fractal-gtk/src/appop/room.rs:137:17
        |
    136 |             if let Some(ref active_room) = self.active_room {
        |                         --------------- immutable borrow occurs here
    137 |                 self.set_active_room_by_id(active_room.clone());
        |                 ^^^^                       ----------- immutable borrow later used here
        |                 |
        |                 mutable borrow occurs here

 fractal-gtk/src/appop/room.rs | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/fractal-gtk/src/appop/room.rs b/fractal-gtk/src/appop/room.rs
index 18a71618..60bde306 100644
--- a/fractal-gtk/src/appop/room.rs
+++ b/fractal-gtk/src/appop/room.rs
@@ -132,9 +132,10 @@ impl AppOp {
                 ))
                 .unwrap();
             });
+
             // Select active room in the sidebar
-            if let Some(ref active_room) = self.active_room {
-                self.set_active_room_by_id(active_room.clone());
+            if let Some(active_room) = self.active_room.clone() {
+                self.set_active_room_by_id(active_room);
             }
             self.cache_rooms();
         }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]