Auto clone a clonable object when used in a new thread

How about this?

use std::sync::Arc;
use std::cell::RefCell;

#[derive(Clone)]
struct MyType;

fn thread(global: Arc<MyType>) {
    thread_local! {
        static CACHED: RefCell<Option<MyType>> = RefCell::new(None);
    }
    CACHED.with(|cached| {
        let mut borrowed = cached.borrow_mut();
        let local: &mut MyType = borrowed.get_or_insert_with(|| (*global).clone());
        
        // use `local` here
    })
}