Simplify
authorAleksey Kladov <aleksey.kladov@gmail.com>
Mon, 16 Apr 2018 15:53:12 +0000 (18:53 +0300)
committerAleksey Kladov <aleksey.kladov@gmail.com>
Mon, 16 Apr 2018 15:53:12 +0000 (18:53 +0300)
src/cargo/util/rustc.rs

index 53f74e130b226ec91af168d9d03ed7d853897951..25bb9b5ba95dbedfec44cff0429f57ca1a548b9d 100644 (file)
@@ -186,15 +186,15 @@ impl Cache {
 
 impl Drop for Cache {
     fn drop(&mut self) {
-        match (&self.cache_location, self.dirty) {
-            (&Some(ref path), true) => {
-                let json = serde_json::to_string(&self.data).unwrap();
-                match paths::write(path, json.as_bytes()) {
-                    Ok(()) => info!("updated rustc info cache"),
-                    Err(e) => warn!("failed to update rustc info cache: {}", e),
-                }
+        if !self.dirty {
+            return;
+        }
+        if let Some(ref path) = self.cache_location {
+            let json = serde_json::to_string(&self.data).unwrap();
+            match paths::write(path, json.as_bytes()) {
+                Ok(()) => info!("updated rustc info cache"),
+                Err(e) => warn!("failed to update rustc info cache: {}", e),
             }
-            _ => (),
         }
     }
 }