Use functional utilities instead of handwritten lambdas when easy to do so.
Fix dangling reference in Foreign::{succ,pred}_impl.