Radish alpha
r
rad:zwTxygwuz5LDGBq255RA2CbNGrz8
Radicle CI broker
Radicle
Git
refactor: drop Worker::name, now unnecessary
Lars Wirzenius committed 2 months ago
commit 0e2bc0de39f6b5f580c10e370cf08776be028750
parent a7c73ce
1 file changed +3 -8
modified src/worker.rs
@@ -11,11 +11,11 @@ use crate::logger;
/// Start a new thread. Caller must catch the thread handle and
/// join it to wait for thread to end.
pub fn start_thread<W: Worker>(mut o: W) -> JoinHandle<Result<(), W::Error>> {
-
    let name = o.name();
+
    let name = W::NAME;
    spawn(move || {
-
        logger::worker_start(&name);
+
        logger::worker_start(name);
        let result = o.work();
-
        logger::worker_end(&name, &result);
+
        logger::worker_end(name, &result);
        result
    })
}
@@ -30,9 +30,4 @@ pub trait Worker: Send + 'static {

    /// Do the work the thread is supposed to do.
    fn work(&mut self) -> Result<(), Self::Error>;
-

-
    /// Return name of thread as an owned string.
-
    fn name(&self) -> String {
-
        Self::NAME.to_string()
-
    }
}