I'm writing a bunch of assertions that all involve popping a value from a list.

Coming from a Scala background, I naturally did this:

```
let mut list = List::new();
let assert_pop = |expected| assert_eq!(list.pop(), expected);

```

So that I could just write `assert_pop(None)` or `assert_pop(Some(3))` instead of having to write `assert_eq!(list.pop(), None)` or `assert_eq!(list.pop(), Some(3))` every time.

Of course the borrow checker doesn't like this one bit because the closure essentially needs to borrow the value for an undisclosed amount of time, while the rest of my code goes around mutating, thus violating the rule of *"no aliasing if you're mutating"*.

The question is: is there a way to get around this? Do I have to write a macro, or is there a funky memory-safe way I can get around this?

**Note** that I know that I can just define the closure like this:

```
let_assert_pop = |lst: &mut List, expected| assert_eq!(lst.pop(), expected);

```

But that would be less *DRY*, as I'd have to pass in a `&mut list` as the first argument at every call.