Replace deprecated Rust methods.