Rust upgrade: fix deprecated methods.