Simplify net.retry config.
authorEric Huss <eric@huss.org>
Tue, 22 May 2018 22:54:31 +0000 (15:54 -0700)
committerEric Huss <eric@huss.org>
Tue, 22 May 2018 22:54:31 +0000 (15:54 -0700)
src/cargo/util/config.rs
src/cargo/util/network.rs

index aadddc84815c59e3f67024fdc81d6dd9051431f3..47625aebef5b46fbf9034ee7f19b1378279c9f34 100644 (file)
@@ -508,13 +508,6 @@ impl Config {
         }
     }
 
-    pub fn net_retry(&self) -> CargoResult<i64> {
-        match self.get::<Option<u32>>("net.retry")? {
-            Some(v) => Ok(v as i64),
-            None => Ok(2),
-        }
-    }
-
     // TODO: why is this pub?
     pub fn expected<T>(&self, ty: &str, key: &str, val: CV) -> CargoResult<T> {
         val.expected(ty, key)
index e789a929d989e112156cbc1fe1df250e02a54b9b..55b18a4cd0d65ffd572b4b406b0f2b301c1b1a8f 100644 (file)
@@ -48,7 +48,7 @@ pub fn with_retry<T, F>(config: &Config, mut callback: F) -> CargoResult<T>
 where
     F: FnMut() -> CargoResult<T>,
 {
-    let mut remaining = config.net_retry()?;
+    let mut remaining = config.get::<Option<u32>>("net.retry")?.unwrap_or(2);
     loop {
         match callback() {
             Ok(ret) => return Ok(ret),