In crystal language, if the last line of a function has no value, this function will return nil, so the function kernel_console can be refactored into one line.
Signed-off-by: Xu Xijian hdxuxijian@163.com --- src/scheduler/kernel_params.cr | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/src/scheduler/kernel_params.cr b/src/scheduler/kernel_params.cr index a558735..2cc8172 100644 --- a/src/scheduler/kernel_params.cr +++ b/src/scheduler/kernel_params.cr @@ -26,11 +26,7 @@ class Job end
private def kernel_console - if os_arch == "x86_64" - return "console=ttyS0,115200 console=tty0" - else - return "" - end + return "console=ttyS0,115200 console=tty0" if os_arch == "x86_64" end
private def set_kernel_params
Pls ignore this mail.
On Tue, Dec 01, 2020 at 12:25:06PM +0800, Xu Xijian wrote:
In crystal language, if the last line of a function has no value, this function will return nil, so the function kernel_console can be refactored into one line.
Signed-off-by: Xu Xijian hdxuxijian@163.com
src/scheduler/kernel_params.cr | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/src/scheduler/kernel_params.cr b/src/scheduler/kernel_params.cr index a558735..2cc8172 100644 --- a/src/scheduler/kernel_params.cr +++ b/src/scheduler/kernel_params.cr @@ -26,11 +26,7 @@ class Job end
private def kernel_console
- if os_arch == "x86_64"
return "console=ttyS0,115200 console=tty0"
- else
return ""
- end
return "console=ttyS0,115200 console=tty0" if os_arch == "x86_64" end
private def set_kernel_params
-- 2.23.0