From: Eric Huss Date: Tue, 22 May 2018 22:54:31 +0000 (-0700) Subject: Simplify net.retry config. X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2^2~11^2~3 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=bef90f314bb52d139bb89b317803fa1a2904cd4e;p=cargo.git Simplify net.retry config. --- diff --git a/src/cargo/util/config.rs b/src/cargo/util/config.rs index aadddc848..47625aebe 100644 --- a/src/cargo/util/config.rs +++ b/src/cargo/util/config.rs @@ -508,13 +508,6 @@ impl Config { } } - pub fn net_retry(&self) -> CargoResult { - match self.get::>("net.retry")? { - Some(v) => Ok(v as i64), - None => Ok(2), - } - } - // TODO: why is this pub? pub fn expected(&self, ty: &str, key: &str, val: CV) -> CargoResult { val.expected(ty, key) diff --git a/src/cargo/util/network.rs b/src/cargo/util/network.rs index e789a929d..55b18a4cd 100644 --- a/src/cargo/util/network.rs +++ b/src/cargo/util/network.rs @@ -48,7 +48,7 @@ pub fn with_retry(config: &Config, mut callback: F) -> CargoResult where F: FnMut() -> CargoResult, { - let mut remaining = config.net_retry()?; + let mut remaining = config.get::>("net.retry")?.unwrap_or(2); loop { match callback() { Ok(ret) => return Ok(ret),