Commit d7424758b5

d7424758b5631cb9e40d0ce64c7c9af70f19bd3e

parent: e0513c5a3e

Unsigned

Damir Jelić <poljar@termina.org.uk> · 2019-11-24 20:25 UTC

executor: Turn some unwraps into excepts.

Layout: unified · split

src/executor.rs +9 −3
@@ -76,11 +76,17 @@ where
76 }; 76 };
77 77
78 let schedule = move |task| { 78 let schedule = move |task| {
79 let mut weechat_notify = weechat_notify.lock().unwrap(); 79 let mut weechat_notify = weechat_notify
80 let mut queue = queue.lock().unwrap(); 80 .lock()
81 .expect("Weechat notification sender lock is poisoned");
82 let mut queue = queue.lock().expect(
83 "Lock of the future queue of the Weechat executor is poisoned",
84 );
81 85
82 queue.push_back(task); 86 queue.push_back(task);
83 weechat_notify.send(()).unwrap(); 87 weechat_notify
88 .send(())
89 .expect("Can't notify Weechat to run a future");
84 }; 90 };
85 91
86 let (task, handle) = async_task::spawn(future, schedule, ()); 92 let (task, handle) = async_task::spawn(future, schedule, ());