From 7be95b15ebdb610b94175c21a8e5fb003be38fef Mon Sep 17 00:00:00 2001 From: "James O. D. Hunt" Date: Fri, 21 Aug 2020 16:39:58 +0100 Subject: [PATCH] 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 --- tools/agent-ctl/src/client.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/agent-ctl/src/client.rs b/tools/agent-ctl/src/client.rs index fec54d2fb..b8dc23128 100644 --- a/tools/agent-ctl/src/client.rs +++ b/tools/agent-ctl/src/client.rs @@ -247,7 +247,7 @@ fn get_agent_cmd_func(name: &str) -> Result { } } - Err(anyhow!(format!("Invalid command: {:?}", name))) + Err(anyhow!("Invalid command: {:?}", name)) } fn get_builtin_cmd_details() -> Vec { @@ -275,7 +275,7 @@ fn get_builtin_cmd_func(name: &str) -> Result { } } - Err(anyhow!(format!("Invalid command: {:?}", name))) + Err(anyhow!("Invalid command: {:?}", name)) } fn client_create_vsock_fd(cid: libc::c_uint, port: u32) -> Result {