summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorZach Reizner <zachr@google.com>2019-09-10 16:11:18 -0700
committerCommit Bot <commit-bot@chromium.org>2019-09-11 09:34:12 +0000
commit506105dc0dcfbbdec907f672e8d782b2f8604447 (patch)
treede31f815541f9195f537bc8142832b68f766762c /tests
parent532533dd3994ef2047dea770e799831b4c38418e (diff)
downloadcrosvm-506105dc0dcfbbdec907f672e8d782b2f8604447.tar
crosvm-506105dc0dcfbbdec907f672e8d782b2f8604447.tar.gz
crosvm-506105dc0dcfbbdec907f672e8d782b2f8604447.tar.bz2
crosvm-506105dc0dcfbbdec907f672e8d782b2f8604447.tar.lz
crosvm-506105dc0dcfbbdec907f672e8d782b2f8604447.tar.xz
crosvm-506105dc0dcfbbdec907f672e8d782b2f8604447.tar.zst
crosvm-506105dc0dcfbbdec907f672e8d782b2f8604447.zip
use `SharedMemory::{named, anon}` to replace `::new`
The new constructors are shorter and omit the bare `None` in the `anon`
call sites which gave no clues to the reader what the effect of that
`None` was. This should improve readability.

TEST=./build_test
BUG=None

Change-Id: I2e34e7df9a4ccc5da50edf4e963a6a42e3d84b22
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1797188
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Zach Reizner <zachr@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/plugins.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/plugins.rs b/tests/plugins.rs
index ec094d1..50abea8 100644
--- a/tests/plugins.rs
+++ b/tests/plugins.rs
@@ -135,13 +135,13 @@ fn keep_fd_on_exec<F: AsRawFd>(f: &F) {
 /// Takes assembly source code and returns the resulting assembly code.
 fn build_assembly(src: &str) -> Vec<u8> {
     // Creates a shared memory region with the assembly source code in it.
-    let in_shm = SharedMemory::new(None).unwrap();
+    let in_shm = SharedMemory::anon().unwrap();
     let mut in_shm_file: File = in_shm.into();
     keep_fd_on_exec(&in_shm_file);
     in_shm_file.write_all(src.as_bytes()).unwrap();
 
     // Creates a shared memory region that will hold the nasm output.
-    let mut out_shm_file: File = SharedMemory::new(None).unwrap().into();
+    let mut out_shm_file: File = SharedMemory::anon().unwrap().into();
     keep_fd_on_exec(&out_shm_file);
 
     // Runs nasm with the input and output files set to the FDs of the above shared memory regions,