diff --git a/lib/src/actions/binary/github.rs b/lib/src/actions/binary/github.rs index ed68b22a..b873ac4f 100644 --- a/lib/src/actions/binary/github.rs +++ b/lib/src/actions/binary/github.rs @@ -41,7 +41,7 @@ impl Action for BinaryGitHub { let async_runtime = match Runtime::new() { Ok(runtime) => runtime, Err(e) => { - return Err(anyhow!("Failed to create async runtime: {}", e)); + return Err(anyhow!("Failed to create async runtime: {e}")); } }; @@ -66,7 +66,7 @@ impl Action for BinaryGitHub { let release = match result { Ok(release) => release, Err(e) => { - return Err(anyhow!("Failed to find a release: {}", e)); + return Err(anyhow!("Failed to find a release: {e}")); } }; diff --git a/lib/src/actions/file/copy.rs b/lib/src/actions/file/copy.rs index 418bc3af..0fcfa0f7 100644 --- a/lib/src/actions/file/copy.rs +++ b/lib/src/actions/file/copy.rs @@ -68,14 +68,12 @@ impl Action for FileCopy { Err(err) => match err.source() { Some(source) => { return Err(anyhow!( - "Failed to render contents for FileCopy action: {}", - source + "Failed to render contents for FileCopy action: {source}" )); } None => { return Err(anyhow!( - "Failed to render contents for FileCopy action: {}", - err + "Failed to render contents for FileCopy action: {err}" )); } }, @@ -87,10 +85,7 @@ impl Action for FileCopy { } } Err(err) => { - return Err(anyhow!( - "Failed to get contents for FileCopy action: {}", - err - )); + return Err(anyhow!("Failed to get contents for FileCopy action: {err}")); } }; diff --git a/lib/src/actions/file/mod.rs b/lib/src/actions/file/mod.rs index 63af21ea..0d9954ff 100644 --- a/lib/src/actions/file/mod.rs +++ b/lib/src/actions/file/mod.rs @@ -50,7 +50,7 @@ pub trait FileAction: Action { "Failed because {} was not found", file_path.to_string_lossy() ), - _ => anyhow!("Failed because {}", e), + _ => anyhow!("Failed because {e}"), }) } } diff --git a/lib/src/actions/mod.rs b/lib/src/actions/mod.rs index 087d00ce..5626d0da 100644 --- a/lib/src/actions/mod.rs +++ b/lib/src/actions/mod.rs @@ -104,7 +104,7 @@ where match engine.eval_with_scope::(&mut scope, condition.as_str()) { Ok(true) => self.action.plan(manifest, context), Ok(false) => Ok(vec![]), - Err(error) => Err(anyhow!("Failed execution condition for action: {}", error)), + Err(error) => Err(anyhow!("Failed execution condition for action: {error}")), } } } diff --git a/lib/src/atoms/command/exec.rs b/lib/src/atoms/command/exec.rs index 903456c3..5e2d68c7 100644 --- a/lib/src/atoms/command/exec.rs +++ b/lib/src/atoms/command/exec.rs @@ -78,8 +78,7 @@ impl Exec { )), Err(err) => Err(anyhow!( - "Command requires privilege escalation, but couldn't elevate privileges: {}", - err + "Command requires privilege escalation, but couldn't elevate privileges: {err}" )), } } @@ -115,7 +114,7 @@ impl Atom for Exec { let (command, arguments) = self.elevate_if_required(); let command = utilities::get_binary_path(&command) - .map_err(|_| anyhow!("Command `{}` not found in path", command))?; + .map_err(|_| anyhow!("Command `{command}` not found in path"))?; // If we require root, we need to use sudo with inherited IO // to ensure the user can respond if prompted for a password diff --git a/lib/src/atoms/plugin/globals.rs b/lib/src/atoms/plugin/globals.rs index 2d5e29b6..0221556e 100644 --- a/lib/src/atoms/plugin/globals.rs +++ b/lib/src/atoms/plugin/globals.rs @@ -56,8 +56,8 @@ fn add_context(lua: &Lua, contexts: Contexts, globals: &Table) -> Result<()> { .map(|json| json_to_lua(&json, lua).map_err(Error::from)) { Ok(Ok(lua_val)) => inner_table.set(k, lua_val)?, - Ok(Err(e)) => Err(anyhow!("Converting {}: {} to Lua {}", &key, k, e))?, - Err(e) => Err(anyhow!("Converting {} to Lua {}", k, e))?, + Ok(Err(e)) => Err(anyhow!("Converting {key}: {k} to Lua {e}"))?, + Err(e) => Err(anyhow!("Converting {k} to Lua {e}"))?, } } diff --git a/lib/src/values/mod.rs b/lib/src/values/mod.rs index 018cf71b..90910d40 100644 --- a/lib/src/values/mod.rs +++ b/lib/src/values/mod.rs @@ -364,8 +364,7 @@ impl TryFrom for Value { Some(n) => n.into(), None => { return Err(anyhow::anyhow!( - "Failed converting number {:?} to json.", - number + "Failed converting number {number:?} to json." )) } } @@ -374,8 +373,7 @@ impl TryFrom for Value { Some(n) => n.into(), None => { return Err(anyhow::anyhow!( - "Failed converting number {:?} to json.", - number + "Failed converting number {number:?} to json." )) } } @@ -384,8 +382,7 @@ impl TryFrom for Value { Some(n) => n.into(), None => { return Err(anyhow::anyhow!( - "Failed converting number {:?} to json.", - number + "Failed converting number {number:?} to json." )) } }