tools: Simplify error handling in agent-ctl

Don't format the error string before passing to the `anyhow!()` macro
since it can format strings itself.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
This commit is contained in:
James O. D. Hunt 2020-08-21 16:39:58 +01:00
parent ad7dce47ca
commit 7be95b15eb

View File

@ -247,7 +247,7 @@ fn get_agent_cmd_func(name: &str) -> Result<AgentCmdFp> {
} }
} }
Err(anyhow!(format!("Invalid command: {:?}", name))) Err(anyhow!("Invalid command: {:?}", name))
} }
fn get_builtin_cmd_details() -> Vec<String> { fn get_builtin_cmd_details() -> Vec<String> {
@ -275,7 +275,7 @@ fn get_builtin_cmd_func(name: &str) -> Result<BuiltinCmdFp> {
} }
} }
Err(anyhow!(format!("Invalid command: {:?}", name))) Err(anyhow!("Invalid command: {:?}", name))
} }
fn client_create_vsock_fd(cid: libc::c_uint, port: u32) -> Result<RawFd> { fn client_create_vsock_fd(cid: libc::c_uint, port: u32) -> Result<RawFd> {