This could be combined with the lower match to be:

```rust
ast::item_impl(_, Some(ref trait_ref) _, _) => {
    Some(node_id_to_trait_ref(tcx, trait_ref.ref_id).def_id)
}
_ => None
```