Преглед изворни кода

Use a reference to avoid extra Arc cloning.

Jing Yang пре 4 година
родитељ
комит
0c60a398ed
1 измењених фајлова са 2 додато и 1 уклоњено
  1. 2 1
      src/lib.rs

+ 2 - 1
src/lib.rs

@@ -253,7 +253,8 @@ where
         let index = rf.log.add_command(term, command);
         self.persister.save_state(rf.persisted_state().into());
 
-        let _ = self.new_log_entry.clone().unwrap().send(None);
+        // Several attempts have been made to remove the unwrap below.
+        let _ = self.new_log_entry.as_ref().unwrap().send(None);
 
         log::info!("{:?} started new entry at {} {:?}", self.me, index, term);
         Some((term, index))