Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tools/helios-build/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ license = "MPL-2.0"
# Report a specific error in the case that the toolchain is too old for
# let-else:
#
rust-version = "1.65.0"
rust-version = "1.70.0"

[dependencies]
anyhow = "1"
Expand Down
15 changes: 6 additions & 9 deletions tools/helios-build/src/ensure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ pub fn file_str<P: AsRef<Path>>(
let mut f = std::fs::OpenOptions::new()
.create_new(true)
.write(true)
.open(&dst)?;
.open(dst)?;
f.write_all(contents.as_bytes())?;
f.flush()?;
}
Expand Down Expand Up @@ -518,10 +518,7 @@ where
T: Read + Send + 'static,
{
let name = name.to_string();
let stream = match stream {
Some(stream) => stream,
None => return None,
};
let stream = stream?;

let log = log.clone();

Expand Down Expand Up @@ -648,7 +645,7 @@ pub fn run_in<S: AsRef<OsStr>, P: AsRef<Path>>(
) -> Result<()> {
let args: Vec<&OsStr> = args.iter().map(|s| s.as_ref()).collect();

let mut cmd = Command::new(&args[0]);
let mut cmd = Command::new(args[0]);
cmd.current_dir(pwd.as_ref());

scrub_env(&mut cmd, false);
Expand All @@ -663,7 +660,7 @@ pub fn run_in<S: AsRef<OsStr>, P: AsRef<Path>>(
pub fn run<S: AsRef<OsStr>>(log: &Logger, args: &[S]) -> Result<()> {
let args: Vec<&OsStr> = args.iter().map(|s| s.as_ref()).collect();

let mut cmd = Command::new(&args[0]);
let mut cmd = Command::new(args[0]);

scrub_env(&mut cmd, false);

Expand All @@ -677,7 +674,7 @@ pub fn run<S: AsRef<OsStr>>(log: &Logger, args: &[S]) -> Result<()> {
pub fn run_utf8<S: AsRef<OsStr>>(log: &Logger, args: &[S]) -> Result<()> {
let args: Vec<&OsStr> = args.iter().map(|s| s.as_ref()).collect();

let mut cmd = Command::new(&args[0]);
let mut cmd = Command::new(args[0]);

scrub_env(&mut cmd, true);

Expand All @@ -697,7 +694,7 @@ where
{
let args: Vec<&OsStr> = args.iter().map(|s| s.as_ref()).collect();

let mut cmd = Command::new(&args[0]);
let mut cmd = Command::new(args[0]);

cmd.env_clear();
cmd.envs(env);
Expand Down
17 changes: 9 additions & 8 deletions tools/helios-build/src/illumos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ pub fn zonename() -> String {
let mut buf: [u8; 64] = std::mem::zeroed(); /* ZONENAME_MAX */

let sz = getzonenamebyid(getzoneid(), buf.as_mut_ptr(), 64);
if sz > 64 || sz < 0 {
if !(0..=64).contains(&sz) {
eprintln!("getzonenamebyid failure");
exit(100);
}
Expand Down Expand Up @@ -425,7 +425,8 @@ pub fn zone_list() -> Result<Vec<Zone>> {

let id = if line[0] == "-" { None } else { Some(line[0].parse()?) };

let uuid = if line[4] == "" { None } else { Some(line[4].to_string()) };
let uuid =
if line[4].is_empty() { None } else { Some(line[4].to_string()) };

zones.push(Zone {
id,
Expand Down Expand Up @@ -489,8 +490,8 @@ where
script += "add fs; ";
script += &format!("set dir = {}; ", ngz.to_str().unwrap());
script += &format!("set special = {}; ", gz.to_str().unwrap());
script += &format!("set type = lofs; ");
script += &format!("set options = [rw,nodevices]; ");
script += "set type = lofs; ";
script += "set options = [rw,nodevices]; ";
script += "end; ";
script += "commit; ";

Expand Down Expand Up @@ -807,7 +808,7 @@ where
.arg(n)
.arg("tee")
.arg("-a")
.arg(&p)
.arg(p)
.stdin(std::process::Stdio::piped())
.spawn()?;

Expand Down Expand Up @@ -846,7 +847,7 @@ where
.arg(n)
.arg("mkdir")
.arg("-p")
.arg(&p)
.arg(p)
.output()?;

if !out.status.success() {
Expand All @@ -859,8 +860,8 @@ where
.arg("-S")
.arg(n)
.arg("chown")
.arg(&format!("{}:{}", uid, gid))
.arg(&p)
.arg(format!("{}:{}", uid, gid))
.arg(p)
.output()?;

if !out.status.success() {
Expand Down
Loading