Stop using ptr.is_not_null() in script.

This method is deprecated in rust master; removing its users in advance will
make a future rust upgrade smoother.