You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Without this, the following results in an error:
```rust
fn subnlas_by_kind<'a>(nlas: &'a [u8]) -> HashMap<u16, Vec<&'a [u8]>> {
let mut out = HashMap::new();
for n in NlasIterator::new(nlas) {
let n = n.unwrap();
let entry: &mut Vec<_> = out.entry(n.kind()).or_default();
(*entry).push(n.value())
}
out
}
```
```
error[E0515]: cannot return value referencing local variable `n`
|
212 | (*entry).push(n.value())
| - `n` is borrowed here
213 | }
214 | out
| ^^^ returns a value referencing data owned by the current function
```
0 commit comments