Add unused result attr to the casting templates

This helped catch a couple of bugs locally.