Skip to content

Commit

Permalink
Merge pull request #208 from rust-cli/renovate/windows-sys-0.x
Browse files Browse the repository at this point in the history
chore(deps): Update Rust crate windows-sys to 0.59.0
  • Loading branch information
epage authored Aug 1, 2024
2 parents 0b348fb + cc7f55b commit 4b8b9c5
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 39 deletions.
67 changes: 38 additions & 29 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/anstyle-query/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pre-release-replacements = [
]

[target.'cfg(windows)'.dependencies]
windows-sys = { version = "0.52.0", features = ["Win32_System_Console", "Win32_Foundation"] }
windows-sys = { version = "0.59.0", features = ["Win32_System_Console", "Win32_Foundation"] }

[lints]
workspace = true
5 changes: 3 additions & 2 deletions crates/anstyle-query/src/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ mod windows_console {
use std::os::windows::io::AsRawHandle;
use std::os::windows::io::RawHandle;

use windows_sys::Win32::Foundation::HANDLE;
use windows_sys::Win32::System::Console::CONSOLE_MODE;
use windows_sys::Win32::System::Console::ENABLE_VIRTUAL_TERMINAL_PROCESSING;

fn enable_vt(handle: RawHandle) -> std::io::Result<()> {
unsafe {
let handle = std::mem::transmute(handle);
if handle == 0 {
let handle: HANDLE = std::mem::transmute(handle);
if handle.is_null() {
return Err(std::io::Error::new(
std::io::ErrorKind::BrokenPipe,
"console is detached",
Expand Down
2 changes: 1 addition & 1 deletion crates/anstyle-wincon/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ anstyle = { version = "1.0.0", path = "../anstyle" }
lexopt = "0.3.0"

[target.'cfg(windows)'.dependencies]
windows-sys = { version = "0.52.0", features = ["Win32_System_Console", "Win32_Foundation"] }
windows-sys = { version = "0.59.0", features = ["Win32_System_Console", "Win32_Foundation"] }

[lints]
workspace = true
13 changes: 7 additions & 6 deletions crates/anstyle-wincon/src/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,16 @@ pub(crate) fn write_colored<S: AsHandle + std::io::Write>(
}

mod inner {
use std::os::windows::io::RawHandle;

use windows_sys::Win32::Foundation::HANDLE;
use windows_sys::Win32::System::Console::CONSOLE_CHARACTER_ATTRIBUTES;
use windows_sys::Win32::System::Console::CONSOLE_SCREEN_BUFFER_INFO;
use windows_sys::Win32::System::Console::FOREGROUND_BLUE;
use windows_sys::Win32::System::Console::FOREGROUND_GREEN;
use windows_sys::Win32::System::Console::FOREGROUND_INTENSITY;
use windows_sys::Win32::System::Console::FOREGROUND_RED;

use std::os::windows::io::RawHandle;

const FOREGROUND_CYAN: CONSOLE_CHARACTER_ATTRIBUTES = FOREGROUND_BLUE | FOREGROUND_GREEN;
const FOREGROUND_MAGENTA: CONSOLE_CHARACTER_ATTRIBUTES = FOREGROUND_BLUE | FOREGROUND_RED;
const FOREGROUND_YELLOW: CONSOLE_CHARACTER_ATTRIBUTES = FOREGROUND_GREEN | FOREGROUND_RED;
Expand Down Expand Up @@ -128,8 +129,8 @@ mod inner {
handle: RawHandle,
) -> Result<CONSOLE_SCREEN_BUFFER_INFO, IoError> {
unsafe {
let handle = std::mem::transmute(handle);
if handle == 0 {
let handle: HANDLE = std::mem::transmute(handle);
if handle.is_null() {
return Err(IoError::BrokenPipe);
}

Expand All @@ -149,8 +150,8 @@ mod inner {
attributes: CONSOLE_CHARACTER_ATTRIBUTES,
) -> Result<(), IoError> {
unsafe {
let handle = std::mem::transmute(handle);
if handle == 0 {
let handle: HANDLE = std::mem::transmute(handle);
if handle.is_null() {
return Err(IoError::BrokenPipe);
}

Expand Down

0 comments on commit 4b8b9c5

Please sign in to comment.