@@ -157,9 +157,7 @@ pub(crate) fn set_speed(termios: &mut Termios, arbitrary_speed: u32) -> io::Resu
157157
158158 debug_assert_eq ! ( encoded_speed & !c:: CBAUD , 0 ) ;
159159
160- // Use `=` and `-` because `-=` behaves differently.
161- termios. control_modes =
162- termios. control_modes - ControlModes :: from_bits_retain ( c:: CBAUD | c:: CIBAUD ) ;
160+ termios. control_modes -= ControlModes :: from_bits_retain ( c:: CBAUD | c:: CIBAUD ) ;
163161 termios. control_modes |=
164162 ControlModes :: from_bits_retain ( encoded_speed | ( encoded_speed << IBSHIFT ) ) ;
165163
@@ -177,8 +175,7 @@ pub(crate) fn set_output_speed(termios: &mut Termios, arbitrary_speed: u32) -> i
177175
178176 debug_assert_eq ! ( encoded_speed & !c:: CBAUD , 0 ) ;
179177
180- // Use `=` and `-` because `-=` behaves differently.
181- termios. control_modes = termios. control_modes - ControlModes :: from_bits_retain ( c:: CBAUD ) ;
178+ termios. control_modes -= ControlModes :: from_bits_retain ( c:: CBAUD ) ;
182179 termios. control_modes |= ControlModes :: from_bits_retain ( encoded_speed) ;
183180
184181 termios. output_speed = arbitrary_speed;
@@ -194,8 +191,7 @@ pub(crate) fn set_input_speed(termios: &mut Termios, arbitrary_speed: u32) -> io
194191
195192 debug_assert_eq ! ( encoded_speed & !c:: CBAUD , 0 ) ;
196193
197- // Use `=` and `-` because `-=` behaves differently.
198- termios. control_modes = termios. control_modes - ControlModes :: from_bits_retain ( c:: CIBAUD ) ;
194+ termios. control_modes -= ControlModes :: from_bits_retain ( c:: CIBAUD ) ;
199195 termios. control_modes |= ControlModes :: from_bits_retain ( encoded_speed << IBSHIFT ) ;
200196
201197 termios. input_speed = arbitrary_speed;
@@ -208,25 +204,21 @@ pub(crate) fn cfmakeraw(termios: &mut Termios) {
208204 // From the Linux [`cfmakeraw` manual page]:
209205 //
210206 // [`cfmakeraw` manual page]: https://man7.org/linux/man-pages/man3/cfmakeraw.3.html
211- //
212- // Use `=` and `-` because `-=` behaves differently.
213- termios. input_modes = termios. input_modes
214- - ( InputModes :: IGNBRK
215- | InputModes :: BRKINT
216- | InputModes :: PARMRK
217- | InputModes :: ISTRIP
218- | InputModes :: INLCR
219- | InputModes :: IGNCR
220- | InputModes :: ICRNL
221- | InputModes :: IXON ) ;
222- termios. output_modes = termios. output_modes - OutputModes :: OPOST ;
223- termios. local_modes = termios. local_modes
224- - ( LocalModes :: ECHO
225- | LocalModes :: ECHONL
226- | LocalModes :: ICANON
227- | LocalModes :: ISIG
228- | LocalModes :: IEXTEN ) ;
229- termios. control_modes = termios. control_modes - ( ControlModes :: CSIZE | ControlModes :: PARENB ) ;
207+ termios. input_modes -= InputModes :: IGNBRK
208+ | InputModes :: BRKINT
209+ | InputModes :: PARMRK
210+ | InputModes :: ISTRIP
211+ | InputModes :: INLCR
212+ | InputModes :: IGNCR
213+ | InputModes :: ICRNL
214+ | InputModes :: IXON ;
215+ termios. output_modes -= OutputModes :: OPOST ;
216+ termios. local_modes -= LocalModes :: ECHO
217+ | LocalModes :: ECHONL
218+ | LocalModes :: ICANON
219+ | LocalModes :: ISIG
220+ | LocalModes :: IEXTEN ;
221+ termios. control_modes -= ControlModes :: CSIZE | ControlModes :: PARENB ;
230222 termios. control_modes |= ControlModes :: CS8 ;
231223
232224 // Musl and glibc also do these:
0 commit comments