From 8bebe4c76107d8b0a55fda238b0475469d374d77 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 26 Oct 2021 17:30:11 +0200 Subject: Switch to 2021 edition --- crates/common/Cargo.toml | 2 +- crates/executor/Cargo.toml | 2 +- crates/executor/src/args.rs | 1 - crates/executor/src/context.rs | 6 +++--- crates/runner/Cargo.toml | 2 +- crates/runner/src/init.rs | 8 ++++---- crates/runner/src/lib.rs | 4 +++- 7 files changed, 13 insertions(+), 12 deletions(-) (limited to 'crates') diff --git a/crates/common/Cargo.toml b/crates/common/Cargo.toml index 2d5b70d..954ebe5 100644 --- a/crates/common/Cargo.toml +++ b/crates/common/Cargo.toml @@ -3,7 +3,7 @@ name = "rebel-common" version = "0.1.0" authors = ["Matthias Schiffer "] license = "MIT" -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/executor/Cargo.toml b/crates/executor/Cargo.toml index 867a9f4..821caa7 100644 --- a/crates/executor/Cargo.toml +++ b/crates/executor/Cargo.toml @@ -3,7 +3,7 @@ name = "rebel" version = "0.1.0" authors = ["Matthias Schiffer "] license = "MIT" -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/executor/src/args.rs b/crates/executor/src/args.rs index 527231d..510a156 100644 --- a/crates/executor/src/args.rs +++ b/crates/executor/src/args.rs @@ -1,7 +1,6 @@ use std::{ collections::{hash_map, HashMap}, hash, - iter::FromIterator, rc::Rc, }; diff --git a/crates/executor/src/context.rs b/crates/executor/src/context.rs index 7a46e8d..8951c50 100644 --- a/crates/executor/src/context.rs +++ b/crates/executor/src/context.rs @@ -3,7 +3,6 @@ use std::{ collections::{HashMap, HashSet}, fmt::Display, hash::Hash, - iter::FromIterator, ops::Index, rc::Rc, result, @@ -146,7 +145,7 @@ pub struct Context { impl Context { pub fn new(tasks: HashMap) -> Self { - let platforms: HashMap<_, _> = IntoIterator::into_iter([ + let platforms: HashMap<_, _> = [ arg( "build", args::Platform { @@ -165,7 +164,8 @@ impl Context { prefix: "/usr".to_string(), }, ), - ]) + ] + .into_iter() .collect(); let globals = TaskArgs::from_iter([ diff --git a/crates/runner/Cargo.toml b/crates/runner/Cargo.toml index b69e51e..5d51739 100644 --- a/crates/runner/Cargo.toml +++ b/crates/runner/Cargo.toml @@ -3,7 +3,7 @@ name = "rebel-runner" version = "0.1.0" authors = ["Matthias Schiffer "] license = "MIT" -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/runner/src/init.rs b/crates/runner/src/init.rs index 783faf4..b2ebbe3 100644 --- a/crates/runner/src/init.rs +++ b/crates/runner/src/init.rs @@ -14,23 +14,23 @@ fn prepare_rootfs(rootfs: &str) -> Result<()> { mount::mount::<_, _, str, str>(Some(rootfs), rootfs, None, MsFlags::MS_BIND, None) .context("Failed to bind mount container rootfs")?; - for dir in IntoIterator::into_iter(["pts", "shm"]) { + for dir in ["pts", "shm"] { fs::mkdir(paths::join(&[rootfs, "dev", dir]))?; } - for (link, target) in IntoIterator::into_iter([ + for (link, target) in [ ("fd", "/proc/self/fd"), ("stdin", "/proc/self/fd/0"), ("stdout", "/proc/self/fd/1"), ("stderr", "/proc/self/fd/2"), ("ptmx", "pts/ptmx"), - ]) { + ] { let path = paths::join(&[rootfs, "dev", link]); std::os::unix::fs::symlink(target, &path) .with_context(|| format!("Failed to create link {}", path))?; } - for dev in IntoIterator::into_iter(["null", "zero", "full", "random", "urandom", "tty"]) { + for dev in ["null", "zero", "full", "random", "urandom", "tty"] { let source = paths::join(&["/dev", dev]); let target = paths::join(&[rootfs, "dev", dev]); fs::create(&target)?; diff --git a/crates/runner/src/lib.rs b/crates/runner/src/lib.rs index d0d8317..21289cf 100644 --- a/crates/runner/src/lib.rs +++ b/crates/runner/src/lib.rs @@ -119,7 +119,9 @@ pub struct Runner { impl Runner { /// Creates a new container runner /// - /// Unsafe: Do not call in multithreaded processes + /// # Safety + /// + /// Do not call in multithreaded processes. pub unsafe fn new(options: &Options) -> Result { let lockfile = unix::lock(paths::LOCKFILE, true, false) .context("Failed to get lock on build directory, is another instance running?")?; -- cgit v1.2.3