From 6a234893eb224025da080d04c986156a01c1c35a Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Tue, 23 Oct 2018 17:33:20 -0700 Subject: [PATCH] Remove use of deprecated APIs. std::error::Error's description() function is [deprecated]; follow the recommended advice and use to_string() instead. [deprecated]: https://doc.rust-lang.org/std/error/trait.Error.html#method.description --- cranelift/src/wasm.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cranelift/src/wasm.rs b/cranelift/src/wasm.rs index 3dd1269980..0012f61f68 100644 --- a/cranelift/src/wasm.rs +++ b/cranelift/src/wasm.rs @@ -9,8 +9,8 @@ use cranelift_codegen::print_errors::{pretty_error, pretty_verifier_error}; use cranelift_codegen::settings::FlagsOrIsa; -use cranelift_codegen::Context; use cranelift_codegen::timing; +use cranelift_codegen::Context; use cranelift_entity::EntityRef; use cranelift_wasm::{ translate_module, DummyEnvironment, FuncIndex, ModuleEnvironment, ReturnMode, @@ -89,13 +89,12 @@ fn handle_module( vprint!(flag_verbose, "Translating... "); let _ = terminal.reset(); - let mut module_binary = - read_to_end(path.clone()).map_err(|err| String::from(err.description()))?; + let mut module_binary = read_to_end(path.clone()).map_err(|err| err.to_string())?; if !module_binary.starts_with(&[b'\0', b'a', b's', b'm']) { module_binary = match wat2wasm(&module_binary) { Ok(data) => data, - Err(e) => return Err(String::from(e.description())), + Err(e) => return Err(e.to_string()), }; }