Skip to content

Commit

Permalink
Try to fix clippy warning
Browse files Browse the repository at this point in the history
  • Loading branch information
gwenn committed Dec 14, 2024
1 parent 1807fe0 commit ea50442
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/tty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub trait RawMode: Sized {
pub enum Event {
KeyPress(KeyEvent),
ExternalPrint(String),
#[cfg(unix)]
#[cfg(target_os = "macos")]
Timeout(bool),
}

Expand Down
9 changes: 6 additions & 3 deletions src/tty/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -782,14 +782,17 @@ impl PosixRawReader {
self.tty_in.get_ref().sigwinch()?;
return Err(ReadlineError::WindowResized);
} else if readfds.contains(tty_in) {
#[cfg(target_os = "macos")]
if timeout.is_some() {
return Ok(Event::Timeout(false));
} else {
// prefer user input over external print
return self.next_key(single_esc_abort).map(Event::KeyPress);
}
// prefer user input over external print
return self.next_key(single_esc_abort).map(Event::KeyPress);
} else if timeout.is_some() {
#[cfg(target_os = "macos")]
return Ok(Event::Timeout(true));
#[cfg(not(target_os = "macos"))]
unreachable!()
} else if let Some(ref pipe_reader) = self.pipe_reader {
let mut guard = pipe_reader.lock().unwrap();
let mut buf = [0; 1];
Expand Down

0 comments on commit ea50442

Please sign in to comment.