@@ -22,9 +22,6 @@ pub extern "C-unwind" fn kclvm_net_split_host_port(
22
22
let ctx = mut_ptr_as_ref ( ctx) ;
23
23
24
24
if let Some ( ip_end_point) = get_call_arg ( args, kwargs, 0 , Some ( "ip_end_point" ) ) {
25
- if ip_end_point. is_none ( ) {
26
- return ValueRef :: none ( ) . into_raw ( ctx) ;
27
- }
28
25
let ip_end_point_str = ip_end_point. as_str ( ) ;
29
26
match ip_end_point_str. rsplit_once ( ':' ) {
30
27
None => panic ! (
@@ -113,9 +110,6 @@ pub extern "C-unwind" fn kclvm_net_join_host_port(
113
110
114
111
if let Some ( host) = get_call_arg ( args, kwargs, 0 , Some ( "host" ) ) {
115
112
if let Some ( port) = get_call_arg ( args, kwargs, 1 , Some ( "port" ) ) {
116
- if host. is_none ( ) || port. is_none ( ) {
117
- return ValueRef :: none ( ) . into_raw ( ctx) ;
118
- }
119
113
if host. as_str ( ) . contains ( ':' ) {
120
114
return ValueRef :: str ( format ! ( "[{host}]:{port}" ) . as_ref ( ) ) . into_raw ( ctx) ;
121
115
}
@@ -477,9 +471,6 @@ pub extern "C-unwind" fn kclvm_net_parse_CIDR(
477
471
let ctx = mut_ptr_as_ref ( ctx) ;
478
472
479
473
if let Some ( cidr) = get_call_arg ( args, kwargs, 0 , Some ( "cidr" ) ) {
480
- if cidr. is_none ( ) {
481
- return ValueRef :: none ( ) . into_raw ( ctx) ;
482
- }
483
474
if let Ok ( cidr) = IpCidr :: from_str ( & cidr. as_str ( ) ) {
484
475
let ip = ValueRef :: str ( & cidr. first_address ( ) . to_string ( ) ) ;
485
476
let mask = ValueRef :: int ( cidr. network_length ( ) . into ( ) ) ;
@@ -676,7 +667,6 @@ mod test_net {
676
667
#[ test]
677
668
fn test_split_host_port ( ) {
678
669
let cases = [
679
- ( ValueRef :: none ( ) , ValueRef :: none ( ) ) ,
680
670
(
681
671
ValueRef :: str ( "invalid.invalid:21" ) ,
682
672
ValueRef :: list ( Some ( & [
@@ -789,14 +779,6 @@ mod test_net {
789
779
#[ test]
790
780
fn test_join_host_port ( ) {
791
781
let cases = [
792
- ( ValueRef :: none ( ) , ValueRef :: none ( ) , ValueRef :: none ( ) ) ,
793
- ( ValueRef :: none ( ) , ValueRef :: int ( 21 ) , ValueRef :: none ( ) ) ,
794
- ( ValueRef :: none ( ) , ValueRef :: str ( "21" ) , ValueRef :: none ( ) ) ,
795
- (
796
- ValueRef :: str ( "invalid.invalid" ) ,
797
- ValueRef :: none ( ) ,
798
- ValueRef :: none ( ) ,
799
- ) ,
800
782
(
801
783
ValueRef :: str ( "invalid.invalid" ) ,
802
784
ValueRef :: int ( 21 ) ,
@@ -900,7 +882,6 @@ mod test_net {
900
882
#[ allow( non_snake_case) ]
901
883
fn test_parse_CIDR ( ) {
902
884
let cases = [
903
- ( ValueRef :: none ( ) , ValueRef :: none ( ) ) ,
904
885
(
905
886
ValueRef :: str ( "0.0.0.0/0" ) ,
906
887
ValueRef :: dict ( Some ( & [
0 commit comments