@@ -569,7 +569,7 @@ where
569
569
arg : Option < & crate :: Arg > ,
570
570
value : & std:: ffi:: OsStr ,
571
571
) -> Result < AnyValue , crate :: Error > {
572
- let value = TypedValueParser :: parse_ref ( self , cmd, arg, value) ? ;
572
+ let value = ok ! ( TypedValueParser :: parse_ref( self , cmd, arg, value) ) ;
573
573
Ok ( AnyValue :: new ( value) )
574
574
}
575
575
@@ -579,7 +579,7 @@ where
579
579
arg : Option < & crate :: Arg > ,
580
580
value : std:: ffi:: OsString ,
581
581
) -> Result < AnyValue , crate :: Error > {
582
- let value = TypedValueParser :: parse ( self , cmd, arg, value) ? ;
582
+ let value = ok ! ( TypedValueParser :: parse( self , cmd, arg, value) ) ;
583
583
Ok ( AnyValue :: new ( value) )
584
584
}
585
585
@@ -694,18 +694,18 @@ where
694
694
arg : Option < & crate :: Arg > ,
695
695
value : & std:: ffi:: OsStr ,
696
696
) -> Result < Self :: Value , crate :: Error > {
697
- let value = value. to_str ( ) . ok_or_else ( || {
697
+ let value = ok ! ( value. to_str( ) . ok_or_else( || {
698
698
crate :: Error :: invalid_utf8(
699
699
cmd,
700
700
crate :: output:: Usage :: new( cmd) . create_usage_with_title( & [ ] ) ,
701
701
)
702
- } ) ? ;
703
- let value = ( self ) ( value) . map_err ( |e| {
702
+ } ) ) ;
703
+ let value = ok ! ( ( self ) ( value) . map_err( |e| {
704
704
let arg = arg
705
705
. map( |a| a. to_string( ) )
706
706
. unwrap_or_else( || "..." . to_owned( ) ) ;
707
707
crate :: Error :: value_validation( arg, value. to_owned( ) , e. into( ) ) . with_cmd( cmd)
708
- } ) ? ;
708
+ } ) ) ;
709
709
Ok ( value)
710
710
}
711
711
}
@@ -742,12 +742,12 @@ impl TypedValueParser for StringValueParser {
742
742
_arg : Option < & crate :: Arg > ,
743
743
value : std:: ffi:: OsString ,
744
744
) -> Result < Self :: Value , crate :: Error > {
745
- let value = value. into_string ( ) . map_err ( |_| {
745
+ let value = ok ! ( value. into_string( ) . map_err( |_| {
746
746
crate :: Error :: invalid_utf8(
747
747
cmd,
748
748
crate :: output:: Usage :: new( cmd) . create_usage_with_title( & [ ] ) ,
749
749
)
750
- } ) ? ;
750
+ } ) ) ;
751
751
Ok ( value)
752
752
}
753
753
}
@@ -939,16 +939,16 @@ impl<E: crate::ValueEnum + Clone + Send + Sync + 'static> TypedValueParser for E
939
939
. collect :: < Vec < _ > > ( )
940
940
} ;
941
941
942
- let value = value. to_str ( ) . ok_or_else ( || {
942
+ let value = ok ! ( value. to_str( ) . ok_or_else( || {
943
943
crate :: Error :: invalid_value(
944
944
cmd,
945
945
value. to_string_lossy( ) . into_owned( ) ,
946
946
& possible_vals( ) ,
947
947
arg. map( ToString :: to_string)
948
948
. unwrap_or_else( || "..." . to_owned( ) ) ,
949
949
)
950
- } ) ? ;
951
- let value = E :: value_variants ( )
950
+ } ) ) ;
951
+ let value = ok ! ( E :: value_variants( )
952
952
. iter( )
953
953
. find( |v| {
954
954
v. to_possible_value( )
@@ -963,7 +963,7 @@ impl<E: crate::ValueEnum + Clone + Send + Sync + 'static> TypedValueParser for E
963
963
arg. map( ToString :: to_string)
964
964
. unwrap_or_else( || "..." . to_owned( ) ) ,
965
965
)
966
- } ) ?
966
+ } ) )
967
967
. clone ( ) ;
968
968
Ok ( value)
969
969
}
@@ -1049,12 +1049,12 @@ impl TypedValueParser for PossibleValuesParser {
1049
1049
arg : Option < & crate :: Arg > ,
1050
1050
value : std:: ffi:: OsString ,
1051
1051
) -> Result < String , crate :: Error > {
1052
- let value = value. into_string ( ) . map_err ( |_| {
1052
+ let value = ok ! ( value. into_string( ) . map_err( |_| {
1053
1053
crate :: Error :: invalid_utf8(
1054
1054
cmd,
1055
1055
crate :: output:: Usage :: new( cmd) . create_usage_with_title( & [ ] ) ,
1056
1056
)
1057
- } ) ? ;
1057
+ } ) ) ;
1058
1058
1059
1059
let ignore_case = arg. map ( |a| a. is_ignore_case_set ( ) ) . unwrap_or ( false ) ;
1060
1060
if self . 0 . iter ( ) . any ( |v| v. matches ( & value, ignore_case) ) {
@@ -1233,13 +1233,13 @@ where
1233
1233
arg : Option < & crate :: Arg > ,
1234
1234
raw_value : & std:: ffi:: OsStr ,
1235
1235
) -> Result < Self :: Value , crate :: Error > {
1236
- let value = raw_value. to_str ( ) . ok_or_else ( || {
1236
+ let value = ok ! ( raw_value. to_str( ) . ok_or_else( || {
1237
1237
crate :: Error :: invalid_utf8(
1238
1238
cmd,
1239
1239
crate :: output:: Usage :: new( cmd) . create_usage_with_title( & [ ] ) ,
1240
1240
)
1241
- } ) ? ;
1242
- let value = value. parse :: < i64 > ( ) . map_err ( |err| {
1241
+ } ) ) ;
1242
+ let value = ok ! ( value. parse:: <i64 >( ) . map_err( |err| {
1243
1243
let arg = arg
1244
1244
. map( |a| a. to_string( ) )
1245
1245
. unwrap_or_else( || "..." . to_owned( ) ) ;
@@ -1249,7 +1249,7 @@ where
1249
1249
err. into( ) ,
1250
1250
)
1251
1251
. with_cmd( cmd)
1252
- } ) ? ;
1252
+ } ) ) ;
1253
1253
if !self . bounds . contains ( & value) {
1254
1254
let arg = arg
1255
1255
. map ( |a| a. to_string ( ) )
@@ -1263,7 +1263,7 @@ where
1263
1263
}
1264
1264
1265
1265
let value: Result < Self :: Value , _ > = value. try_into ( ) ;
1266
- let value = value. map_err ( |err| {
1266
+ let value = ok ! ( value. map_err( |err| {
1267
1267
let arg = arg
1268
1268
. map( |a| a. to_string( ) )
1269
1269
. unwrap_or_else( || "..." . to_owned( ) ) ;
@@ -1273,7 +1273,7 @@ where
1273
1273
err. into( ) ,
1274
1274
)
1275
1275
. with_cmd( cmd)
1276
- } ) ? ;
1276
+ } ) ) ;
1277
1277
1278
1278
Ok ( value)
1279
1279
}
@@ -1431,13 +1431,13 @@ where
1431
1431
arg : Option < & crate :: Arg > ,
1432
1432
raw_value : & std:: ffi:: OsStr ,
1433
1433
) -> Result < Self :: Value , crate :: Error > {
1434
- let value = raw_value. to_str ( ) . ok_or_else ( || {
1434
+ let value = ok ! ( raw_value. to_str( ) . ok_or_else( || {
1435
1435
crate :: Error :: invalid_utf8(
1436
1436
cmd,
1437
1437
crate :: output:: Usage :: new( cmd) . create_usage_with_title( & [ ] ) ,
1438
1438
)
1439
- } ) ? ;
1440
- let value = value. parse :: < u64 > ( ) . map_err ( |err| {
1439
+ } ) ) ;
1440
+ let value = ok ! ( value. parse:: <u64 >( ) . map_err( |err| {
1441
1441
let arg = arg
1442
1442
. map( |a| a. to_string( ) )
1443
1443
. unwrap_or_else( || "..." . to_owned( ) ) ;
@@ -1447,7 +1447,7 @@ where
1447
1447
err. into( ) ,
1448
1448
)
1449
1449
. with_cmd( cmd)
1450
- } ) ? ;
1450
+ } ) ) ;
1451
1451
if !self . bounds . contains ( & value) {
1452
1452
let arg = arg
1453
1453
. map ( |a| a. to_string ( ) )
@@ -1461,7 +1461,7 @@ where
1461
1461
}
1462
1462
1463
1463
let value: Result < Self :: Value , _ > = value. try_into ( ) ;
1464
- let value = value. map_err ( |err| {
1464
+ let value = ok ! ( value. map_err( |err| {
1465
1465
let arg = arg
1466
1466
. map( |a| a. to_string( ) )
1467
1467
. unwrap_or_else( || "..." . to_owned( ) ) ;
@@ -1471,7 +1471,7 @@ where
1471
1471
err. into( ) ,
1472
1472
)
1473
1473
. with_cmd( cmd)
1474
- } ) ? ;
1474
+ } ) ) ;
1475
1475
1476
1476
Ok ( value)
1477
1477
}
@@ -1622,12 +1622,12 @@ impl TypedValueParser for FalseyValueParser {
1622
1622
_arg : Option < & crate :: Arg > ,
1623
1623
value : & std:: ffi:: OsStr ,
1624
1624
) -> Result < Self :: Value , crate :: Error > {
1625
- let value = value. to_str ( ) . ok_or_else ( || {
1625
+ let value = ok ! ( value. to_str( ) . ok_or_else( || {
1626
1626
crate :: Error :: invalid_utf8(
1627
1627
cmd,
1628
1628
crate :: output:: Usage :: new( cmd) . create_usage_with_title( & [ ] ) ,
1629
1629
)
1630
- } ) ? ;
1630
+ } ) ) ;
1631
1631
let value = if value. is_empty ( ) {
1632
1632
false
1633
1633
} else {
@@ -1719,19 +1719,19 @@ impl TypedValueParser for BoolishValueParser {
1719
1719
arg : Option < & crate :: Arg > ,
1720
1720
value : & std:: ffi:: OsStr ,
1721
1721
) -> Result < Self :: Value , crate :: Error > {
1722
- let value = value. to_str ( ) . ok_or_else ( || {
1722
+ let value = ok ! ( value. to_str( ) . ok_or_else( || {
1723
1723
crate :: Error :: invalid_utf8(
1724
1724
cmd,
1725
1725
crate :: output:: Usage :: new( cmd) . create_usage_with_title( & [ ] ) ,
1726
1726
)
1727
- } ) ? ;
1728
- let value = crate :: util:: str_to_bool ( value) . ok_or_else ( || {
1727
+ } ) ) ;
1728
+ let value = ok ! ( crate :: util:: str_to_bool( value) . ok_or_else( || {
1729
1729
let arg = arg
1730
1730
. map( |a| a. to_string( ) )
1731
1731
. unwrap_or_else( || "..." . to_owned( ) ) ;
1732
1732
crate :: Error :: value_validation( arg, value. to_owned( ) , "value was not a boolean" . into( ) )
1733
1733
. with_cmd( cmd)
1734
- } ) ? ;
1734
+ } ) ) ;
1735
1735
Ok ( value)
1736
1736
}
1737
1737
@@ -1808,12 +1808,12 @@ impl TypedValueParser for NonEmptyStringValueParser {
1808
1808
. unwrap_or_else ( || "..." . to_owned ( ) ) ,
1809
1809
) ) ;
1810
1810
}
1811
- let value = value. to_str ( ) . ok_or_else ( || {
1811
+ let value = ok ! ( value. to_str( ) . ok_or_else( || {
1812
1812
crate :: Error :: invalid_utf8(
1813
1813
cmd,
1814
1814
crate :: output:: Usage :: new( cmd) . create_usage_with_title( & [ ] ) ,
1815
1815
)
1816
- } ) ? ;
1816
+ } ) ) ;
1817
1817
Ok ( value. to_owned ( ) )
1818
1818
}
1819
1819
}
@@ -1860,7 +1860,7 @@ where
1860
1860
arg : Option < & crate :: Arg > ,
1861
1861
value : & std:: ffi:: OsStr ,
1862
1862
) -> Result < Self :: Value , crate :: Error > {
1863
- let value = self . parser . parse_ref ( cmd, arg, value) ? ;
1863
+ let value = ok ! ( self . parser. parse_ref( cmd, arg, value) ) ;
1864
1864
let value = ( self . func ) ( value) ;
1865
1865
Ok ( value)
1866
1866
}
@@ -1871,7 +1871,7 @@ where
1871
1871
arg : Option < & crate :: Arg > ,
1872
1872
value : std:: ffi:: OsString ,
1873
1873
) -> Result < Self :: Value , crate :: Error > {
1874
- let value = self . parser . parse ( cmd, arg, value) ? ;
1874
+ let value = ok ! ( self . parser. parse( cmd, arg, value) ) ;
1875
1875
let value = ( self . func ) ( value) ;
1876
1876
Ok ( value)
1877
1877
}
0 commit comments