Format cg_gcc with same formatting parameters
This commit is contained in:
parent
12bedc3e2b
commit
213782dd71
8 changed files with 18 additions and 54 deletions
|
@ -34,7 +34,7 @@ impl Args {
|
|||
"--out-path" => match args.next() {
|
||||
Some(path) if !path.is_empty() => out_path = Some(path),
|
||||
_ => {
|
||||
return Err("Expected an argument after `--out-path`, found nothing".into())
|
||||
return Err("Expected an argument after `--out-path`, found nothing".into());
|
||||
}
|
||||
},
|
||||
"--help" => {
|
||||
|
|
|
@ -54,7 +54,7 @@ impl ConfigFile {
|
|||
config.gcc_path = Some(value.as_str().to_string())
|
||||
}
|
||||
("gcc-path", _) => {
|
||||
return failed_config_parsing(config_file, "Expected a string for `gcc-path`")
|
||||
return failed_config_parsing(config_file, "Expected a string for `gcc-path`");
|
||||
}
|
||||
("download-gccjit", TomlValue::Boolean(value)) => {
|
||||
config.download_gccjit = Some(*value)
|
||||
|
@ -63,7 +63,7 @@ impl ConfigFile {
|
|||
return failed_config_parsing(
|
||||
config_file,
|
||||
"Expected a boolean for `download-gccjit`",
|
||||
)
|
||||
);
|
||||
}
|
||||
_ => return failed_config_parsing(config_file, &format!("Unknown key `{}`", key)),
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ impl ConfigFile {
|
|||
return failed_config_parsing(
|
||||
config_file,
|
||||
"At least one of `gcc-path` or `download-gccjit` value must be set",
|
||||
)
|
||||
);
|
||||
}
|
||||
(Some(_), Some(true)) => {
|
||||
println!(
|
||||
|
@ -144,7 +144,7 @@ impl ConfigInfo {
|
|||
_ => {
|
||||
return Err(
|
||||
"Expected a value after `--target-triple`, found nothing".to_string()
|
||||
)
|
||||
);
|
||||
}
|
||||
},
|
||||
"--out-dir" => match args.next() {
|
||||
|
@ -158,7 +158,7 @@ impl ConfigInfo {
|
|||
self.config_file = Some(arg.to_string());
|
||||
}
|
||||
_ => {
|
||||
return Err("Expected a value after `--config-file`, found nothing".to_string())
|
||||
return Err("Expected a value after `--config-file`, found nothing".to_string());
|
||||
}
|
||||
},
|
||||
"--release-sysroot" => self.sysroot_release_channel = true,
|
||||
|
@ -169,7 +169,7 @@ impl ConfigInfo {
|
|||
self.cg_gcc_path = Some(arg.into());
|
||||
}
|
||||
_ => {
|
||||
return Err("Expected a value after `--cg_gcc-path`, found nothing".to_string())
|
||||
return Err("Expected a value after `--cg_gcc-path`, found nothing".to_string());
|
||||
}
|
||||
},
|
||||
"--use-backend" => match args.next() {
|
||||
|
@ -277,7 +277,7 @@ impl ConfigInfo {
|
|||
self.gcc_path = match gcc_path {
|
||||
Some(path) => path,
|
||||
None => {
|
||||
return Err(format!("missing `gcc-path` value from `{}`", config_file.display(),))
|
||||
return Err(format!("missing `gcc-path` value from `{}`", config_file.display(),));
|
||||
}
|
||||
};
|
||||
Ok(())
|
||||
|
|
|
@ -109,7 +109,7 @@ impl TestArg {
|
|||
test_arg.flags.extend_from_slice(&["--features".into(), feature]);
|
||||
}
|
||||
_ => {
|
||||
return Err("Expected an argument after `--features`, found nothing".into())
|
||||
return Err("Expected an argument after `--features`, found nothing".into());
|
||||
}
|
||||
},
|
||||
"--use-system-gcc" => {
|
||||
|
@ -458,11 +458,7 @@ fn setup_rustc(env: &mut Env, args: &TestArg) -> Result<PathBuf, String> {
|
|||
.map_err(|error| format!("Failed to retrieve cargo path: {:?}", error))
|
||||
.and_then(|cargo| {
|
||||
let cargo = cargo.trim().to_owned();
|
||||
if cargo.is_empty() {
|
||||
Err(format!("`cargo` path is empty"))
|
||||
} else {
|
||||
Ok(cargo)
|
||||
}
|
||||
if cargo.is_empty() { Err(format!("`cargo` path is empty")) } else { Ok(cargo) }
|
||||
})?;
|
||||
let rustc = String::from_utf8(
|
||||
run_command_with_env(&[&"rustup", &toolchain, &"which", &"rustc"], rust_dir, Some(env))?
|
||||
|
@ -471,11 +467,7 @@ fn setup_rustc(env: &mut Env, args: &TestArg) -> Result<PathBuf, String> {
|
|||
.map_err(|error| format!("Failed to retrieve rustc path: {:?}", error))
|
||||
.and_then(|rustc| {
|
||||
let rustc = rustc.trim().to_owned();
|
||||
if rustc.is_empty() {
|
||||
Err(format!("`rustc` path is empty"))
|
||||
} else {
|
||||
Ok(rustc)
|
||||
}
|
||||
if rustc.is_empty() { Err(format!("`rustc` path is empty")) } else { Ok(rustc) }
|
||||
})?;
|
||||
let llvm_filecheck = match run_command_with_env(
|
||||
&[
|
||||
|
|
|
@ -175,11 +175,7 @@ pub fn cargo_install(to_install: &str) -> Result<(), String> {
|
|||
pub fn get_os_name() -> Result<String, String> {
|
||||
let output = run_command(&[&"uname"], None)?;
|
||||
let name = std::str::from_utf8(&output.stdout).unwrap_or("").trim().to_string();
|
||||
if !name.is_empty() {
|
||||
Ok(name)
|
||||
} else {
|
||||
Err("Failed to retrieve the OS name".to_string())
|
||||
}
|
||||
if !name.is_empty() { Ok(name) } else { Err("Failed to retrieve the OS name".to_string()) }
|
||||
}
|
||||
|
||||
#[derive(Default, PartialEq)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue