Trying to update the cache in the `None` arm would certainly fail to work, because `match *cache` would keep an immutable `&` borrow on the `RefCell`. But something like this should work:

```rust
let mut cache = self.span_tree_cache.borrow_mut();
match *cache {
    Some(ref x) return x.clone(),
    None => ()
}

let span_tree = self.calc_span_tree();
*cache = Some(span_tree);
```

Not that it's particularly important. I was just suggesting it as being slightly more idiomatic than `is_some()` + `get_ref()`.