chore: clippy on redundant closure (#4058)

Add redundant closure clippy rules and let Codex fix it by minimising
FQP
This commit is contained in:
jif-oai
2025-09-22 20:30:16 +01:00
committed by GitHub
parent c75920a071
commit be366a31ab
43 changed files with 97 additions and 86 deletions

View File

@@ -1,3 +1,4 @@
use std::borrow::Cow;
use std::ffi::OsString;
use std::path::Path;
use std::path::PathBuf;
@@ -108,7 +109,7 @@ fn ensure_absolute_path(path: &str, cwd: &Option<OsString>) -> Result<PathBuf> {
file.absolutize()
};
result
.map(|path| path.into_owned())
.map(Cow::into_owned)
.map_err(|error| CannotCanonicalizePath {
file: path.to_string(),
error: error.kind(),

View File

@@ -10,6 +10,7 @@ use codex_execpolicy::get_default_policy;
use serde::Deserialize;
use serde::Serialize;
use serde::de;
use starlark::Error as StarlarkError;
use std::path::PathBuf;
use std::str::FromStr;
@@ -71,13 +72,13 @@ fn main() -> Result<()> {
}
None => get_default_policy(),
};
let policy = policy.map_err(|err| err.into_anyhow())?;
let policy = policy.map_err(StarlarkError::into_anyhow)?;
let exec = match args.command {
Command::Check { command } => match command.split_first() {
Some((first, rest)) => ExecArg {
program: first.to_string(),
args: rest.iter().map(|s| s.to_string()).collect(),
args: rest.to_vec(),
},
None => {
eprintln!("no command provided");
@@ -161,6 +162,6 @@ impl FromStr for ExecArg {
type Err = anyhow::Error;
fn from_str(s: &str) -> Result<Self, Self::Err> {
serde_json::from_str(s).map_err(|e| e.into())
serde_json::from_str(s).map_err(Into::into)
}
}

View File

@@ -169,7 +169,7 @@ impl ProgramSpec {
let mut options = self
.required_options
.difference(&matched_opt_names)
.map(|s| s.to_string())
.map(String::from)
.collect::<Vec<_>>();
options.sort();
return Err(Error::MissingRequiredOptions {