1- use std :: ffi:: c_void;
1+ use core :: ffi:: c_void;
22use std:: fs:: OpenOptions ;
33use std:: io:: { stderr, stdin, stdout, Error , ErrorKind , IsTerminal , Read , Result , Write } ;
44use std:: os:: windows:: io:: { AsRawHandle , OwnedHandle } ;
5- use std :: ptr:: { from_mut, null} ;
5+ use core :: ptr:: { from_mut, null} ;
66
77use windows_sys:: Win32 :: Foundation ;
88use windows_sys:: Win32 :: Globalization ;
@@ -29,16 +29,16 @@ enum RawConnectionHandle {
2929
3030impl RawConnectionHandle {
3131 fn input ( & self ) -> RawHandle {
32- match self {
33- Self :: Owned ( input, _) => input. as_raw_handle ( ) ,
34- Self :: StdIo ( input, _) => * input,
32+ match * self {
33+ Self :: Owned ( ref input, _) => input. as_raw_handle ( ) ,
34+ Self :: StdIo ( ref input, _) => * input,
3535 }
3636 }
3737
3838 fn output ( & self ) -> RawHandle {
39- match self {
40- Self :: Owned ( _, output) => output. as_raw_handle ( ) ,
41- Self :: StdIo ( _, output) => * output,
39+ match * self {
40+ Self :: Owned ( _, ref output) => output. as_raw_handle ( ) ,
41+ Self :: StdIo ( _, ref output) => * output,
4242 }
4343 }
4444}
@@ -48,6 +48,7 @@ impl RawConnectionHandle {
4848// `Sync`](https://github.com/rust-lang/rust/blob/8e37e151835d96d6a7415e93e6876561485a3354/library/std/src/os/windows/io/handle.rs#L111),
4949// for wrapped handles, too. Also, access to raw input is gated by a mutex.
5050unsafe impl Send for RawConnectionHandle { }
51+ // SAFETY: See previous comment.
5152unsafe impl Sync for RawConnectionHandle { }
5253
5354/// A connection to a terminal device.
@@ -128,16 +129,16 @@ enum ModeGroup {
128129
129130impl ModeGroup {
130131 pub fn all ( ) -> impl core:: iter:: Iterator < Item = ModeGroup > {
131- core:: iter:: successors ( Some ( Self :: Input ) , |n | {
132- Some ( match n {
132+ core:: iter:: successors ( Some ( Self :: Input ) , |g | {
133+ Some ( match * g {
133134 Self :: Input => Self :: Output ,
134135 Self :: Output => return None ,
135136 } )
136137 } )
137138 }
138139
139140 pub fn name ( & self ) -> & ' static str {
140- match self {
141+ match * self {
141142 Self :: Input => "input_modes" ,
142143 Self :: Output => "output_modes" ,
143144 }
@@ -350,7 +351,7 @@ impl Read for RawInput {
350351 unsafe {
351352 Console :: ReadConsoleA (
352353 self . handle ,
353- buf. as_mut_ptr ( ) as * mut c_void ,
354+ buf. as_mut_ptr ( ) . cast :: < c_void > ( ) ,
354355 buf. len ( ) as u32 ,
355356 from_mut ( & mut did_read) ,
356357 null ( ) ,
0 commit comments