Skip to content

Commit a5dc19b

Browse files
committed
Fix remaining clippy errors
1 parent 21f162b commit a5dc19b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/main.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ pub fn get_external_ip(api_endpoint: &str) -> Result<std::string::String, failur
3636
pub fn get_external_ipv6() -> Result<std::string::String, failure::Error> {
3737
// Allows users to optionally configure which endpoints are used, with a sensible default.
3838
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());
4040
get_external_ip(&api_endpoint)
4141
}
4242

4343
pub fn get_external_ipv4() -> Result<std::string::String, failure::Error> {
4444
// 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());
4747
get_external_ip(&api_endpoint)
4848
}
4949

@@ -179,8 +179,8 @@ fn create_or_update_record(
179179
fn check_ips_and_update_dns(
180180
user: &str,
181181
api_key: &str,
182-
hosts_vec: &Vec<&str>,
183-
zones_vec: &Vec<&str>,
182+
hosts_vec: &[&str],
183+
zones_vec: &[&str],
184184
ipv4: bool,
185185
ipv6: bool,
186186
) -> Result<(), failure::Error> {
@@ -236,7 +236,7 @@ fn main() -> Result<(), failure::Error> {
236236
.expect("CLOUDFLAREDDNS_RECORDTYPES environment variable not set");
237237
// Get repeat interval, with a default value of 0, which runs only once.
238238
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());
240240
// Parse this string value into a 64-bit unsigned integer.
241241
let repeat_interval: u64 = repeat_interval.parse().unwrap_or(0);
242242
let record_type_values = record_types.split(';').collect::<Vec<_>>();

0 commit comments

Comments
 (0)