mirror of
https://github.com/asciinema/asciinema.git
synced 2025-12-15 19:28:00 +01:00
Collapse nested ifs
This commit is contained in:
@@ -116,13 +116,11 @@ impl cli::Record {
|
||||
fn get_tty(&self) -> Result<Box<dyn tty::Tty>> {
|
||||
if self.headless {
|
||||
Ok(Box::new(tty::NullTty::open()?))
|
||||
} else if let Ok(dev_tty) = tty::DevTty::open() {
|
||||
Ok(Box::new(dev_tty))
|
||||
} else {
|
||||
if let Ok(dev_tty) = tty::DevTty::open() {
|
||||
Ok(Box::new(dev_tty))
|
||||
} else {
|
||||
logger::info!("TTY not available, recording in headless mode");
|
||||
Ok(Box::new(tty::NullTty::open()?))
|
||||
}
|
||||
logger::info!("TTY not available, recording in headless mode");
|
||||
Ok(Box::new(tty::NullTty::open()?))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -141,13 +141,11 @@ impl cli::Stream {
|
||||
fn get_tty(&self) -> Result<Box<dyn tty::Tty>> {
|
||||
if self.headless {
|
||||
Ok(Box::new(tty::NullTty::open()?))
|
||||
} else if let Ok(dev_tty) = tty::DevTty::open() {
|
||||
Ok(Box::new(dev_tty))
|
||||
} else {
|
||||
if let Ok(dev_tty) = tty::DevTty::open() {
|
||||
Ok(Box::new(dev_tty))
|
||||
} else {
|
||||
logger::info!("TTY not available, streaming in headless mode");
|
||||
Ok(Box::new(tty::NullTty::open()?))
|
||||
}
|
||||
logger::info!("TTY not available, streaming in headless mode");
|
||||
Ok(Box::new(tty::NullTty::open()?))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user