arch: replace is_some + unwrap with if let

BUG=None
TEST=emerge-kevin crosvm

Change-Id: I78aa9f4fb4fb46de3394bb9bc2fa5a53e210fa0b
Signed-off-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1896085
Reviewed-by: Zach Reizner <zachr@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Daniel Verkamp 2019-10-16 12:54:20 -07:00 committed by Commit Bot
parent 2b109386e7
commit 7a5a7fc44f
2 changed files with 4 additions and 4 deletions

View file

@ -373,8 +373,8 @@ impl AArch64 {
/// This returns a base part of the kernel command for this architecture
fn get_base_linux_cmdline(stdio_serial_num: Option<u8>) -> kernel_cmdline::Cmdline {
let mut cmdline = kernel_cmdline::Cmdline::new(sys_util::pagesize());
if stdio_serial_num.is_some() {
let tty_string = get_serial_tty_string(stdio_serial_num.unwrap());
if let Some(stdio_serial_num) = stdio_serial_num {
let tty_string = get_serial_tty_string(stdio_serial_num);
cmdline.insert("console", &tty_string).unwrap();
}
cmdline.insert_str("panic=-1").unwrap();

View file

@ -594,8 +594,8 @@ impl X8664arch {
/// This returns a minimal kernel command for this architecture
fn get_base_linux_cmdline(stdio_serial_num: Option<u8>) -> kernel_cmdline::Cmdline {
let mut cmdline = kernel_cmdline::Cmdline::new(CMDLINE_MAX_SIZE as usize);
if stdio_serial_num.is_some() {
let tty_string = get_serial_tty_string(stdio_serial_num.unwrap());
if let Some(stdio_serial_num) = stdio_serial_num {
let tty_string = get_serial_tty_string(stdio_serial_num);
cmdline.insert("console", &tty_string).unwrap();
}
cmdline.insert_str("noacpi reboot=k panic=-1").unwrap();