@@ -36,14 +36,14 @@ pub fn get_external_ip(api_endpoint: &str) -> Result<std::string::String, failur
36
36
pub fn get_external_ipv6 ( ) -> Result < std:: string:: String , failure:: Error > {
37
37
// Allows users to optionally configure which endpoints are used, with a sensible default.
38
38
let api_endpoint = env:: var ( "CLOUDFLAREDDNS_IPV6_API_ENDPOINT" )
39
- . unwrap_or ( "https://api6.ipify.org" . to_string ( ) ) ;
39
+ . unwrap_or_else ( |_| "https://api6.ipify.org" . to_string ( ) ) ;
40
40
get_external_ip ( & api_endpoint)
41
41
}
42
42
43
43
pub fn get_external_ipv4 ( ) -> Result < std:: string:: String , failure:: Error > {
44
44
// Allows users to optionally configure which endpoints are used, with a sensible default.
45
- let api_endpoint =
46
- env :: var ( "CLOUDFLAREDDNS_IPV4_API_ENDPOINT" ) . unwrap_or ( "https://api.ipify.org" . to_string ( ) ) ;
45
+ let api_endpoint = env :: var ( "CLOUDFLAREDDNS_IPV4_API_ENDPOINT" )
46
+ . unwrap_or_else ( |_| "https://api.ipify.org" . to_string ( ) ) ;
47
47
get_external_ip ( & api_endpoint)
48
48
}
49
49
@@ -179,8 +179,8 @@ fn create_or_update_record(
179
179
fn check_ips_and_update_dns (
180
180
user : & str ,
181
181
api_key : & str ,
182
- hosts_vec : & Vec < & str > ,
183
- zones_vec : & Vec < & str > ,
182
+ hosts_vec : & [ & str ] ,
183
+ zones_vec : & [ & str ] ,
184
184
ipv4 : bool ,
185
185
ipv6 : bool ,
186
186
) -> Result < ( ) , failure:: Error > {
@@ -236,7 +236,7 @@ fn main() -> Result<(), failure::Error> {
236
236
. expect ( "CLOUDFLAREDDNS_RECORDTYPES environment variable not set" ) ;
237
237
// Get repeat interval, with a default value of 0, which runs only once.
238
238
let repeat_interval =
239
- std:: env:: var ( "CLOUDFLAREDDNS_REPEAT_INTERVAL" ) . unwrap_or ( "0" . to_string ( ) ) ;
239
+ std:: env:: var ( "CLOUDFLAREDDNS_REPEAT_INTERVAL" ) . unwrap_or_else ( |_| "0" . to_string ( ) ) ;
240
240
// Parse this string value into a 64-bit unsigned integer.
241
241
let repeat_interval: u64 = repeat_interval. parse ( ) . unwrap_or ( 0 ) ;
242
242
let record_type_values = record_types. split ( ';' ) . collect :: < Vec < _ > > ( ) ;
0 commit comments