Convert Shellerror::GenericError to named fields (#11230)

# Description

Replace `.to_string()` used in `GenericError` with `.into()` as
`.into()` seems more popular

Replace `Vec::new()` used in `GenericError` with `vec![]` as `vec![]`
seems more popular

(There are so, so many)
This commit is contained in:
Eric Hodel
2023-12-06 15:40:03 -08:00
committed by GitHub
parent b03f1efac4
commit a95a4505ef
160 changed files with 2975 additions and 3228 deletions

View File

@ -601,16 +601,16 @@ impl ExternalCommand {
}
process
} else {
return Err(ShellError::GenericError(
"Current directory not found".to_string(),
"did not find PWD environment variable".to_string(),
Some(span),
Some(concat!(
return Err(ShellError::GenericError{
error: "Current directory not found".into(),
msg: "did not find PWD environment variable".into(),
span: Some(span),
help: Some(concat!(
"The environment variable 'PWD' was not found. ",
"It is required to define the current directory when running an external command."
).to_string()),
Vec::new(),
));
).into()),
inner:Vec::new(),
});
};
process.envs(&self.env_vars);