Fix CI failures (#746)

This commit is contained in:
Jonathan 2023-01-12 22:04:29 +02:00 committed by GitHub
parent 614e6a73b7
commit 814df1c4a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 26 additions and 27 deletions

View File

@ -330,7 +330,7 @@ impl Command for Show {
/// A command that enables blinking of the terminal cursor.
///
/// See `SetCursorStyle` which is more advanced and better supported.
///
///
/// # Notes
///
/// - Windows versions lower than Windows 10 do not support this functionality.
@ -347,9 +347,8 @@ impl Command for EnableBlinking {
}
}
/// A command that disables blinking of the terminal cursor.
///
///
/// See `SetCursorStyle` which is more advanced and better supported.
///
/// # Notes
@ -370,7 +369,7 @@ impl Command for DisableBlinking {
/// A command that sets the style of the cursor.
/// It uses two types of escape codes, one to control blinking, and the other the shape.
///
///
/// # Note
///
/// - Commands must be executed/queued for execution otherwise they do nothing.

View File

@ -8,4 +8,4 @@ pub(crate) mod mio;
pub(crate) use self::tty::UnixInternalEventSource;
#[cfg(not(feature = "use-dev-tty"))]
pub(crate) use self::mio::UnixInternalEventSource;
pub(crate) use self::mio::UnixInternalEventSource;

View File

@ -12,15 +12,13 @@ use filedescriptor::{poll, pollfd, POLLIN};
#[cfg(feature = "event-stream")]
use crate::event::sys::Waker;
use crate::{
event::{
sys::unix::{
file_descriptor::{tty_fd, FileDesc},
parse::parse_event,
},
InternalEvent,
source::EventSource,
use crate::event::{
source::EventSource,
sys::unix::{
file_descriptor::{tty_fd, FileDesc},
parse::parse_event,
},
InternalEvent,
};
/// Holds a prototypical Waker and a receiver we can wait on when doing select().

View File

@ -37,7 +37,7 @@ impl FileDesc {
self.fd,
buffer.as_mut_ptr() as *mut libc::c_void,
size as size_t,
)
)
};
if result < 0 {

View File

@ -8,4 +8,4 @@ pub(crate) mod mio;
pub(crate) use self::tty::Waker;
#[cfg(not(feature = "use-dev-tty"))]
pub(crate) use self::mio::Waker;
pub(crate) use self::mio::Waker;

View File

@ -33,4 +33,4 @@ impl Waker {
pub(crate) fn reset(&self) -> Result<()> {
Ok(())
}
}
}

View File

@ -110,7 +110,7 @@ fn try_ensure_char_case(ch: char, desired_case: CharCase) -> char {
let mut iter = ch.to_lowercase();
// Unwrap is safe; iterator yields one or more chars.
let ch_lower = iter.next().unwrap();
if iter.next() == None {
if iter.next().is_none() {
ch_lower
} else {
ch
@ -120,7 +120,7 @@ fn try_ensure_char_case(ch: char, desired_case: CharCase) -> char {
let mut iter = ch.to_uppercase();
// Unwrap is safe; iterator yields one or more chars.
let ch_upper = iter.next().unwrap();
if iter.next() == None {
if iter.next().is_none() {
ch_upper
} else {
ch
@ -186,7 +186,7 @@ fn get_char_for_key(key_event: &KeyEventRecord) -> Option<char> {
let mut ch_iter = std::char::decode_utf16(utf16_buf.into_iter().take(ret as usize));
let mut ch = ch_iter.next()?.ok()?;
if ch_iter.next() != None {
if ch_iter.next().is_some() {
// Key doesn't map to a single char.
return None;
}

View File

@ -34,8 +34,8 @@ pub(crate) fn set_foreground_color(fg_color: Color) -> Result<()> {
// background intensity is a separate value in attrs,
// we need to check if this was applied to the current bg color.
if (attrs & wincon::BACKGROUND_INTENSITY as u16) != 0 {
color |= wincon::BACKGROUND_INTENSITY as u16;
if (attrs & wincon::BACKGROUND_INTENSITY) != 0 {
color |= wincon::BACKGROUND_INTENSITY;
}
Console::from(screen_buffer.handle().clone()).set_text_attribute(color)?;
@ -58,8 +58,8 @@ pub(crate) fn set_background_color(bg_color: Color) -> Result<()> {
// Foreground intensity is a separate value in attrs,
// So we need to check if this was applied to the current fg color.
if (attrs & wincon::FOREGROUND_INTENSITY as u16) != 0 {
color |= wincon::FOREGROUND_INTENSITY as u16;
if (attrs & wincon::FOREGROUND_INTENSITY) != 0 {
color |= wincon::FOREGROUND_INTENSITY;
}
Console::from(screen_buffer.handle().clone()).set_text_attribute(color)?;

View File

@ -123,13 +123,15 @@ fn read_supports_keyboard_enhancement_raw() -> Result<bool> {
// ESC [ c Query primary device attributes.
const QUERY: &[u8] = b"\x1B[?u\x1B[c";
if let Err(_) = File::open("/dev/tty").and_then(|mut file| {
let result = File::open("/dev/tty").and_then(|mut file| {
file.write_all(QUERY)?;
file.flush()
}) {
});
if result.is_err() {
let mut stdout = io::stdout();
stdout.write_all(QUERY)?;
stdout.flush()?;
return Ok(false);
}
loop {

View File

@ -234,7 +234,7 @@ fn clear_after_cursor(location: Coord, buffer_size: Size, current_attribute: u16
let (mut x, mut y) = (location.x, location.y);
// if cursor position is at the outer right position
if x as i16 > buffer_size.width {
if x > buffer_size.width {
y += 1;
x = 0;
}
@ -303,7 +303,7 @@ fn clear_until_line(location: Coord, buffer_size: Size, current_attribute: u16)
let start_location = Coord::new(x, y);
// get sum cells before cursor
let cells_to_write = (buffer_size.width - x as i16) as u32;
let cells_to_write = (buffer_size.width - x) as u32;
// clear until the current line
clear_winapi(start_location, cells_to_write, current_attribute)?;