@@ -157,9 +157,7 @@ pub(crate) fn set_speed(termios: &mut Termios, arbitrary_speed: u32) -> io::Resu
157
157
158
158
debug_assert_eq ! ( encoded_speed & !c:: CBAUD , 0 ) ;
159
159
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 ) ;
163
161
termios. control_modes |=
164
162
ControlModes :: from_bits_retain ( encoded_speed | ( encoded_speed << IBSHIFT ) ) ;
165
163
@@ -177,8 +175,7 @@ pub(crate) fn set_output_speed(termios: &mut Termios, arbitrary_speed: u32) -> i
177
175
178
176
debug_assert_eq ! ( encoded_speed & !c:: CBAUD , 0 ) ;
179
177
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 ) ;
182
179
termios. control_modes |= ControlModes :: from_bits_retain ( encoded_speed) ;
183
180
184
181
termios. output_speed = arbitrary_speed;
@@ -194,8 +191,7 @@ pub(crate) fn set_input_speed(termios: &mut Termios, arbitrary_speed: u32) -> io
194
191
195
192
debug_assert_eq ! ( encoded_speed & !c:: CBAUD , 0 ) ;
196
193
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 ) ;
199
195
termios. control_modes |= ControlModes :: from_bits_retain ( encoded_speed << IBSHIFT ) ;
200
196
201
197
termios. input_speed = arbitrary_speed;
@@ -208,25 +204,21 @@ pub(crate) fn cfmakeraw(termios: &mut Termios) {
208
204
// From the Linux [`cfmakeraw` manual page]:
209
205
//
210
206
// [`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 ;
230
222
termios. control_modes |= ControlModes :: CS8 ;
231
223
232
224
// Musl and glibc also do these:
0 commit comments