mirror of
https://github.com/asciinema/asciinema.git
synced 2025-12-16 11:48:13 +01:00
Collapse nested ifs
This commit is contained in:
@@ -116,15 +116,13 @@ 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() {
|
||||
} 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()?))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn get_output(
|
||||
&self,
|
||||
|
||||
@@ -141,15 +141,13 @@ 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() {
|
||||
} 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()?))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn init_logging(&self) -> Result<()> {
|
||||
let log_file = self.log_file.as_ref().cloned();
|
||||
|
||||
Reference in New Issue
Block a user