@@ -13,7 +13,7 @@ use std::collections::HashMap;
13
13
use std:: env;
14
14
use std:: error:: Error ;
15
15
use std:: net:: IpAddr ;
16
- #[ cfg( target_os = "macos" ) ]
16
+ #[ cfg( all ( target_os = "macos" , feature = "macos-system-configuration" ) ) ]
17
17
use system_configuration:: {
18
18
core_foundation:: {
19
19
base:: CFType ,
@@ -947,7 +947,7 @@ fn get_from_platform_impl() -> Result<Option<String>, Box<dyn Error>> {
947
947
Ok ( ( proxy_enable == 1 ) . then_some ( proxy_server) )
948
948
}
949
949
950
- #[ cfg( target_os = "macos" ) ]
950
+ #[ cfg( all ( target_os = "macos" , feature = "macos-system-configuration" ) ) ]
951
951
fn parse_setting_from_dynamic_store (
952
952
proxies_map : & CFDictionary < CFString , CFType > ,
953
953
enabled_key : CFStringRef ,
@@ -985,7 +985,7 @@ fn parse_setting_from_dynamic_store(
985
985
None
986
986
}
987
987
988
- #[ cfg( target_os = "macos" ) ]
988
+ #[ cfg( all ( target_os = "macos" , feature = "macos-system-configuration" ) ) ]
989
989
fn get_from_platform_impl ( ) -> Result < Option < String > , Box < dyn Error > > {
990
990
let store = SCDynamicStoreBuilder :: new ( "reqwest" ) . build ( ) ;
991
991
@@ -1016,12 +1016,18 @@ fn get_from_platform_impl() -> Result<Option<String>, Box<dyn Error>> {
1016
1016
}
1017
1017
}
1018
1018
1019
- #[ cfg( any( target_os = "windows" , target_os = "macos" ) ) ]
1019
+ #[ cfg( any(
1020
+ target_os = "windows" ,
1021
+ all( target_os = "macos" , feature = "macos-system-configuration" )
1022
+ ) ) ]
1020
1023
fn get_from_platform ( ) -> Option < String > {
1021
1024
get_from_platform_impl ( ) . ok ( ) . flatten ( )
1022
1025
}
1023
1026
1024
- #[ cfg( not( any( target_os = "windows" , target_os = "macos" ) ) ) ]
1027
+ #[ cfg( not( any(
1028
+ target_os = "windows" ,
1029
+ all( target_os = "macos" , feature = "macos-system-configuration" )
1030
+ ) ) ) ]
1025
1031
fn get_from_platform ( ) -> Option < String > {
1026
1032
None
1027
1033
}
0 commit comments