Skip to content

Commit a9492df

Browse files
committed
Fix clippy issues
1 parent 18760c9 commit a9492df

File tree

4 files changed

+14
-15
lines changed

4 files changed

+14
-15
lines changed

src/ansi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ mod tests {
314314

315315
fn _check_all_strings_of_len(len: usize, chunk: &mut Vec<u8>) {
316316
if len == 0 {
317-
if let Ok(s) = std::str::from_utf8(chunk) {
317+
if let Ok(s) = core::str::from_utf8(chunk) {
318318
let old_matches: Vec<_> = STRIP_ANSI_RE.find_iter(s).collect();
319319
let new_matches: Vec<_> = Matches::new(s).collect();
320320
assert_eq!(old_matches, new_matches);

src/unix_term.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#[cfg(target_os = "macos")]
2+
use core::ptr;
13
use core::{fmt::Display, mem, str};
24
use std::env;
35
use std::fs;
@@ -163,7 +165,7 @@ fn select_fd(fd: RawFd, timeout: i32) -> io::Result<bool> {
163165

164166
let mut timeout_val;
165167
let timeout = if timeout < 0 {
166-
std::ptr::null_mut()
168+
ptr::null_mut()
167169
} else {
168170
timeout_val = libc::timeval {
169171
tv_sec: (timeout / 1000) as _,
@@ -177,8 +179,8 @@ fn select_fd(fd: RawFd, timeout: i32) -> io::Result<bool> {
177179
let ret = libc::select(
178180
fd + 1,
179181
&mut read_fd_set,
180-
std::ptr::null_mut(),
181-
std::ptr::null_mut(),
182+
ptr::null_mut(),
183+
ptr::null_mut(),
182184
timeout,
183185
);
184186
if ret < 0 {

src/windows_term/colors.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
use crate::ansi::AnsiCodeIterator;
2+
use core::mem;
3+
use core::str::{from_utf8, Bytes};
14
use std::io;
2-
use std::mem;
35
use std::os::windows::io::AsRawHandle;
4-
use std::str::Bytes;
56

67
use windows_sys::Win32::Foundation::HANDLE;
78
use windows_sys::Win32::System::Console::{
@@ -289,9 +290,6 @@ impl Color {
289290
}
290291

291292
pub(crate) fn console_colors(out: &Term, mut con: Console, bytes: &[u8]) -> io::Result<()> {
292-
use crate::ansi::AnsiCodeIterator;
293-
use std::str::from_utf8;
294-
295293
let s = from_utf8(bytes).expect("data to be printed is not an ansi string");
296294
let mut iter = AnsiCodeIterator::new(s);
297295

src/windows_term/mod.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
use std::cmp;
1+
use core::fmt::Display;
2+
use core::iter::once;
3+
use core::mem::{self, MaybeUninit};
4+
use core::{char, cmp};
25
use std::env;
36
use std::ffi::OsStr;
4-
use std::fmt::Display;
57
use std::io;
6-
use std::iter::once;
7-
use std::mem;
88
use std::os::raw::c_void;
99
use std::os::windows::ffi::OsStrExt;
1010
use std::os::windows::io::AsRawHandle;
11-
use std::{char, mem::MaybeUninit};
1211

1312
use encode_unicode::error::Utf16TupleError;
1413
use encode_unicode::CharExt;
@@ -590,7 +589,7 @@ pub(crate) fn msys_tty_on(term: &Term) -> bool {
590589
handle as HANDLE,
591590
FileNameInfo,
592591
&mut name_info as *mut _ as *mut c_void,
593-
std::mem::size_of::<FILE_NAME_INFO>() as u32,
592+
mem::size_of::<FILE_NAME_INFO>() as u32,
594593
);
595594
if res == 0 {
596595
return false;

0 commit comments

Comments
 (0)