@@ -36,14 +36,7 @@ use uucore::format_usage;
3636use uucore:: parser:: num_parser:: ExtendedParser ;
3737use uucore:: translate;
3838
39- #[ cfg( not( any(
40- target_os = "freebsd" ,
41- target_os = "dragonfly" ,
42- target_os = "ios" ,
43- target_os = "macos" ,
44- target_os = "netbsd" ,
45- target_os = "openbsd"
46- ) ) ) ]
39+ #[ cfg( not( bsd) ) ]
4740use flags:: BAUD_RATES ;
4841use flags:: { CONTROL_CHARS , CONTROL_FLAGS , INPUT_FLAGS , LOCAL_FLAGS , OUTPUT_FLAGS } ;
4942
@@ -624,26 +617,12 @@ fn print_terminal_size(
624617 let mut printer = WrappedPrinter :: new ( window_size) ;
625618
626619 // BSDs use a u32 for the baud rate, so we can simply print it.
627- #[ cfg( any(
628- target_os = "freebsd" ,
629- target_os = "dragonfly" ,
630- target_os = "ios" ,
631- target_os = "macos" ,
632- target_os = "netbsd" ,
633- target_os = "openbsd"
634- ) ) ]
620+ #[ cfg( bsd) ]
635621 printer. print ( & translate ! ( "stty-output-speed" , "speed" => speed) ) ;
636622
637623 // Other platforms need to use the baud rate enum, so printing the right value
638624 // becomes slightly more complicated.
639- #[ cfg( not( any(
640- target_os = "freebsd" ,
641- target_os = "dragonfly" ,
642- target_os = "ios" ,
643- target_os = "macos" ,
644- target_os = "netbsd" ,
645- target_os = "openbsd"
646- ) ) ) ]
625+ #[ cfg( not( bsd) ) ]
647626 for ( text, baud_rate) in BAUD_RATES {
648627 if * baud_rate == speed {
649628 printer. print ( & translate ! ( "stty-output-speed" , "speed" => ( * text) ) ) ;
@@ -752,24 +731,10 @@ fn string_to_baud(arg: &str, baud_type: flags::BaudType) -> Option<AllFlags<'_>>
752731 let value = parse_baud_with_rounding ( normalized) ?;
753732
754733 // BSDs use a u32 for the baud rate, so any decimal number applies.
755- #[ cfg( any(
756- target_os = "freebsd" ,
757- target_os = "dragonfly" ,
758- target_os = "ios" ,
759- target_os = "macos" ,
760- target_os = "netbsd" ,
761- target_os = "openbsd"
762- ) ) ]
734+ #[ cfg( bsd) ]
763735 return Some ( AllFlags :: Baud ( value, baud_type) ) ;
764736
765- #[ cfg( not( any(
766- target_os = "freebsd" ,
767- target_os = "dragonfly" ,
768- target_os = "ios" ,
769- target_os = "macos" ,
770- target_os = "netbsd" ,
771- target_os = "openbsd"
772- ) ) ) ]
737+ #[ cfg( not( bsd) ) ]
773738 {
774739 for ( text, baud_rate) in BAUD_RATES {
775740 if text. parse :: < u32 > ( ) . ok ( ) == Some ( value) {
@@ -1440,29 +1405,15 @@ mod tests {
14401405 // Tests for string_to_baud
14411406 #[ test]
14421407 fn test_string_to_baud_valid ( ) {
1443- #[ cfg( not( any(
1444- target_os = "freebsd" ,
1445- target_os = "dragonfly" ,
1446- target_os = "ios" ,
1447- target_os = "macos" ,
1448- target_os = "netbsd" ,
1449- target_os = "openbsd"
1450- ) ) ) ]
1408+ #[ cfg( not( bsd) ) ]
14511409 {
14521410 assert ! ( string_to_baud( "9600" , flags:: BaudType :: Both ) . is_some( ) ) ;
14531411 assert ! ( string_to_baud( "115200" , flags:: BaudType :: Both ) . is_some( ) ) ;
14541412 assert ! ( string_to_baud( "38400" , flags:: BaudType :: Both ) . is_some( ) ) ;
14551413 assert ! ( string_to_baud( "19200" , flags:: BaudType :: Both ) . is_some( ) ) ;
14561414 }
14571415
1458- #[ cfg( any(
1459- target_os = "freebsd" ,
1460- target_os = "dragonfly" ,
1461- target_os = "ios" ,
1462- target_os = "macos" ,
1463- target_os = "netbsd" ,
1464- target_os = "openbsd"
1465- ) ) ]
1416+ #[ cfg( bsd) ]
14661417 {
14671418 assert ! ( string_to_baud( "9600" , flags:: BaudType :: Both ) . is_some( ) ) ;
14681419 assert ! ( string_to_baud( "115200" , flags:: BaudType :: Both ) . is_some( ) ) ;
@@ -1473,14 +1424,7 @@ mod tests {
14731424
14741425 #[ test]
14751426 fn test_string_to_baud_invalid ( ) {
1476- #[ cfg( not( any(
1477- target_os = "freebsd" ,
1478- target_os = "dragonfly" ,
1479- target_os = "ios" ,
1480- target_os = "macos" ,
1481- target_os = "netbsd" ,
1482- target_os = "openbsd"
1483- ) ) ) ]
1427+ #[ cfg( not( bsd) ) ]
14841428 {
14851429 assert_eq ! ( string_to_baud( "995" , flags:: BaudType :: Both ) , None ) ;
14861430 assert_eq ! ( string_to_baud( "invalid" , flags:: BaudType :: Both ) , None ) ;
0 commit comments