summaryrefslogtreecommitdiffstats
path: root/crates/runner/src
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2021-10-26 17:30:11 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2021-10-26 17:30:11 +0200
commit8bebe4c76107d8b0a55fda238b0475469d374d77 (patch)
treef16f7ea339af3c442e5daddf9c6ba0c8119a1a29 /crates/runner/src
parente57b743058836ef34d4dd96fca5d6152f910140c (diff)
downloadrebel-8bebe4c76107d8b0a55fda238b0475469d374d77.tar
rebel-8bebe4c76107d8b0a55fda238b0475469d374d77.zip
Switch to 2021 edition
Diffstat (limited to 'crates/runner/src')
-rw-r--r--crates/runner/src/init.rs8
-rw-r--r--crates/runner/src/lib.rs4
2 files changed, 7 insertions, 5 deletions
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<Self> {
let lockfile = unix::lock(paths::LOCKFILE, true, false)
.context("Failed to get lock on build directory, is another instance running?")?;