From a46f20bc6e78402a358758cb43188a0dbcf2762f Mon Sep 17 00:00:00 2001 From: Stefan Lankes Date: Thu, 2 May 2024 10:04:41 +0200 Subject: [PATCH] improving readability of the serial port --- src/arch/aarch64/serial.rs | 6 ++---- src/arch/x86_64/serial.rs | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/arch/aarch64/serial.rs b/src/arch/aarch64/serial.rs index 9e85410..b7fa1fa 100644 --- a/src/arch/aarch64/serial.rs +++ b/src/arch/aarch64/serial.rs @@ -10,10 +10,8 @@ pub struct ComPort { impl ComPort { /// Create a new COM port with the specified base address. - const fn new(base_addr: u32) -> ComPort { - ComPort { - base_addr: base_addr, - } + const fn new(base_addr: u32) -> Self { + Self { base_addr } } } diff --git a/src/arch/x86_64/serial.rs b/src/arch/x86_64/serial.rs index 248a6f5..26c385f 100644 --- a/src/arch/x86_64/serial.rs +++ b/src/arch/x86_64/serial.rs @@ -11,10 +11,8 @@ pub struct ComPort { impl ComPort { /// Create a new COM port with the specified base address. - const fn new(base_addr: u16) -> ComPort { - ComPort { - base_addr: base_addr, - } + const fn new(base_addr: u16) -> Self { + Self { base_addr } } }