Skip to content

Commit 6b99fb4

Browse files
committed
Merging with main
1 parent dda8d67 commit 6b99fb4

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

uefi-test-runner/src/proto/shell.rs

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
use uefi::CStr16;
12
use uefi::boot;
23
use uefi::proto::shell::Shell;
3-
use uefi::CStr16;
44
use uefi_raw::Status;
55

66
pub fn test() {
@@ -68,7 +68,9 @@ pub fn test() {
6868
let status = shell.set_cur_dir(Some(fs_var), Some(dir_var));
6969
assert_eq!(status, Status::SUCCESS);
7070

71-
let cur_fs_str = shell.get_cur_dir(Some(fs_var)).expect("Could not get the current file system mapping");
71+
let cur_fs_str = shell
72+
.get_cur_dir(Some(fs_var))
73+
.expect("Could not get the current file system mapping");
7274
let expected_fs_str = CStr16::from_str_with_buf("FS0:\\", &mut test_buf).unwrap();
7375
assert_eq!(cur_fs_str, expected_fs_str);
7476

@@ -77,7 +79,9 @@ pub fn test() {
7779
let status = shell.set_cur_dir(Some(fs_var), Some(dir_var));
7880
assert_eq!(status, Status::SUCCESS);
7981

80-
let cur_fs_str = shell.get_cur_dir(Some(fs_var)).expect("Could not get the current file system mapping");
82+
let cur_fs_str = shell
83+
.get_cur_dir(Some(fs_var))
84+
.expect("Could not get the current file system mapping");
8185
assert_ne!(cur_fs_str, expected_fs_str);
8286
let expected_fs_str = CStr16::from_str_with_buf("FS1:\\", &mut test_buf).unwrap();
8387
assert_eq!(cur_fs_str, expected_fs_str);
@@ -87,7 +91,9 @@ pub fn test() {
8791
let status = shell.set_cur_dir(Some(fs_var), Some(dir_var));
8892
assert_eq!(status, Status::SUCCESS);
8993

90-
let cur_fs_str = shell.get_cur_dir(Some(fs_var)).expect("Could not get the current file system mapping");
94+
let cur_fs_str = shell
95+
.get_cur_dir(Some(fs_var))
96+
.expect("Could not get the current file system mapping");
9197
assert_ne!(cur_fs_str, expected_fs_str);
9298
let expected_fs_str = CStr16::from_str_with_buf("FS0:\\efi", &mut test_buf).unwrap();
9399
assert_eq!(cur_fs_str, expected_fs_str);
@@ -96,17 +102,23 @@ pub fn test() {
96102
let dir_var = CStr16::from_str_with_buf("fs0:/", &mut dir_buf).unwrap();
97103
let status = shell.set_cur_dir(None, Some(dir_var));
98104
assert_eq!(status, Status::SUCCESS);
99-
let cur_fs_str = shell.get_cur_dir(Some(fs_var)).expect("Could not get the current file system mapping");
105+
let cur_fs_str = shell
106+
.get_cur_dir(Some(fs_var))
107+
.expect("Could not get the current file system mapping");
100108
let expected_fs_str = CStr16::from_str_with_buf("FS0:", &mut test_buf).unwrap();
101109
assert_eq!(cur_fs_str, expected_fs_str);
102110

103-
let cur_fs_str = shell.get_cur_dir(None).expect("Could not get the current file system mapping");
111+
let cur_fs_str = shell
112+
.get_cur_dir(None)
113+
.expect("Could not get the current file system mapping");
104114
assert_eq!(cur_fs_str, expected_fs_str);
105115

106116
let dir_var = CStr16::from_str_with_buf("/efi", &mut dir_buf).unwrap();
107117
let status = shell.set_cur_dir(None, Some(dir_var));
108118
assert_eq!(status, Status::SUCCESS);
109-
let cur_fs_str = shell.get_cur_dir(Some(fs_var)).expect("Could not get the current file system mapping");
119+
let cur_fs_str = shell
120+
.get_cur_dir(Some(fs_var))
121+
.expect("Could not get the current file system mapping");
110122
let expected_fs_str = CStr16::from_str_with_buf("FS0:\\efi", &mut test_buf).unwrap();
111123
assert_eq!(cur_fs_str, expected_fs_str);
112124

uefi/src/proto/shell/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,7 @@ impl Shell {
233233
/// * `None` - Could not retrieve current directory
234234
#[must_use]
235235
pub fn get_cur_dir<'a>(&'a self, file_system_mapping: Option<&CStr16>) -> Option<&'a CStr16> {
236-
let mapping_ptr: *const Char16 =
237-
file_system_mapping.map_or(ptr::null(), |x| (x.as_ptr()));
236+
let mapping_ptr: *const Char16 = file_system_mapping.map_or(ptr::null(), |x| (x.as_ptr()));
238237
let cur_dir = (self.get_cur_dir)(mapping_ptr);
239238
if cur_dir.is_null() {
240239
None

0 commit comments

Comments
 (0)