auto clippy fixes

This commit is contained in:
Folkert 2023-06-26 20:42:50 +02:00
parent 72c85efc83
commit ef39bad7c6
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
146 changed files with 750 additions and 1005 deletions

View file

@ -416,12 +416,10 @@ pub fn test(matches: &ArgMatches, triple: Triple) -> io::Result<i32> {
match matches.value_source(ROC_FILE) {
Some(ValueSource::DefaultValue) => {
eprintln!(
"\nThe current directory ({}) does not contain a {} file to use as a default.\n\nYou can run `roc help` for more information on how to provide a .roc file.\n",
current_dir_string,
DEFAULT_ROC_FILENAME
"\nThe current directory ({current_dir_string}) does not contain a {DEFAULT_ROC_FILENAME} file to use as a default.\n\nYou can run `roc help` for more information on how to provide a .roc file.\n"
)
}
_ => eprintln!("\nThis file was not found: {}\n\nYou can run `roc help` for more information on how to provide a .roc file.\n", expected_file_path_string),
_ => eprintln!("\nThis file was not found: {expected_file_path_string}\n\nYou can run `roc help` for more information on how to provide a .roc file.\n"),
}
process::exit(1);
@ -565,16 +563,13 @@ pub fn build(
match matches.value_source(ROC_FILE) {
Some(ValueSource::DefaultValue) => {
eprintln!(
"\nThe current directory ({}) does not contain a {} file to use as a default.\n\nYou can run `roc help` for more information on how to provide a .roc file.\n",
current_dir_string,
DEFAULT_ROC_FILENAME
"\nThe current directory ({current_dir_string}) does not contain a {DEFAULT_ROC_FILENAME} file to use as a default.\n\nYou can run `roc help` for more information on how to provide a .roc file.\n"
)
}
_ => {
let mut error_lines = Vec::new();
error_lines.push(format!(
"This file was not found: {}",
expected_file_path_string
"This file was not found: {expected_file_path_string}"
));
// Add some additional hints if run as `roc [FILENAME]`.
if matches.subcommand().is_none() {
@ -584,8 +579,7 @@ pub fn build(
nearest_match(possible_typo, subcommands)
{
error_lines.push(format!(
"Did you mean to use the {} subcommand?",
nearest_command
"Did you mean to use the {nearest_command} subcommand?"
));
}
}
@ -1144,7 +1138,7 @@ fn roc_run_executable_file_path(binary_bytes: &[u8]) -> std::io::Result<Executab
);
}
let path = PathBuf::from(format!("/proc/self/fd/{}", fd));
let path = PathBuf::from(format!("/proc/self/fd/{fd}"));
std::fs::write(&path, binary_bytes)?;
@ -1351,7 +1345,7 @@ impl std::str::FromStr for Target {
"linux64" => Ok(Target::Linux64),
"windows64" => Ok(Target::Windows64),
"wasm32" => Ok(Target::Wasm32),
_ => Err(format!("Roc does not know how to compile to {}", string)),
_ => Err(format!("Roc does not know how to compile to {string}")),
}
}
}