diff options
author | Luca Casonato <hello@lcas.dev> | 2022-06-26 00:13:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-26 00:13:24 +0200 |
commit | 8d82ba729937baf83011354242cabc3d50c13dc2 (patch) | |
tree | 3e8c4d87986338639eeef4a76543e4335020262c /runtime/ops/tty.rs | |
parent | 38505db39137f33bfdb942658ea892a617ac0980 (diff) |
build: require safety comments on unsafe code (#13870)
Co-authored-by: Bartek IwaĆczuk <biwanczuk@gmail.com>
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
Diffstat (limited to 'runtime/ops/tty.rs')
-rw-r--r-- | runtime/ops/tty.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/runtime/ops/tty.rs b/runtime/ops/tty.rs index ad152e2da..62a7717a6 100644 --- a/runtime/ops/tty.rs +++ b/runtime/ops/tty.rs @@ -172,12 +172,16 @@ fn op_isatty(state: &mut OpState, rid: ResourceId) -> Result<bool, AnyError> { let handle = get_windows_handle(std_file)?; let mut test_mode: DWORD = 0; // If I cannot get mode out of console, it is not a console. + // TODO(bartlomieju): + #[allow(clippy::undocumented_unsafe_blocks)] Ok(unsafe { consoleapi::GetConsoleMode(handle, &mut test_mode) != FALSE }) } #[cfg(unix)] { use std::os::unix::io::AsRawFd; let raw_fd = std_file.as_raw_fd(); + // TODO(bartlomieju): + #[allow(clippy::undocumented_unsafe_blocks)] Ok(unsafe { libc::isatty(raw_fd as libc::c_int) == 1 }) } })?; @@ -225,6 +229,8 @@ fn op_console_size( use std::os::unix::io::AsRawFd; let fd = std_file.as_raw_fd(); + // TODO(bartlomieju): + #[allow(clippy::undocumented_unsafe_blocks)] unsafe { let mut size: libc::winsize = std::mem::zeroed(); if libc::ioctl(fd, libc::TIOCGWINSZ, &mut size as *mut _) != 0 { |