From 418d1e6fe927949503872db2062e092226ca2b58 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Wed, 10 Nov 2021 00:43:28 +0100 Subject: drop unused code from get_console_fd() --- src/vtcol.rs | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/vtcol.rs b/src/vtcol.rs index 31ea9d9..e9af6e2 100644 --- a/src/vtcol.rs +++ b/src/vtcol.rs @@ -526,29 +526,18 @@ fn fd_of_path(path: &std::path::Path) -> Option } } -fn get_console_fd(path: Option<&str>) -> Option +fn get_console_fd() -> Option { - match path { - Some(path) => { - let path = std::path::Path::new(path); - match fd_of_path(path) { - Some(fd) => Some(fd), - None => panic!("cannot open {:?} as a tty", path), - } - }, - None => { - for path in CONSOLE_PATHS.iter() { - vrb!("trying path: {:?}", path); - let path = std::path::Path::new(path); - if let Some(fd) = fd_of_path(path) { - vrb!(" * Success!"); - return Some(fd); - } - } - vrb!("could not retrieve fd for any of the search paths"); - None - }, + for path in CONSOLE_PATHS.iter() { + vrb!("trying path: {:?}", path); + let path = std::path::Path::new(path); + if let Some(fd) = fd_of_path(path) { + vrb!(" * Success!"); + return Some(fd); + } } + vrb!("could not retrieve fd for any of the search paths"); + None } fn write_to_term(fd: Fd, buf: &str) @@ -579,7 +568,7 @@ fn main() }; vrb!("Using palette:"); vrb!("{}", pal); - let fd = get_console_fd(None).unwrap(); + let fd = get_console_fd().unwrap(); vrb!("fd: {}", fd); if unsafe { ioctl(fd, PIO_CMAP, std::mem::transmute(&mut pal)) } < 0 { -- cgit v1.2.3