]> git.proxmox.com Git - cargo.git/commitdiff
Use an expect instead of directly panicking
authorMark Rousskov <mark.simulacrum@gmail.com>
Mon, 20 Jan 2020 17:47:56 +0000 (12:47 -0500)
committerMark Rousskov <mark.simulacrum@gmail.com>
Wed, 22 Jan 2020 19:20:41 +0000 (14:20 -0500)
src/cargo/core/compiler/job_queue.rs

index 3b8049dcaf08f64be4034859be08ece2b754a971..56f22e9962ca5d3693f182871db09b1a61978239 100644 (file)
@@ -542,12 +542,12 @@ impl<'a, 'cfg> DrainState<'a, 'cfg> {
                 // Note that this pops off potentially a completely
                 // different token, but all tokens of the same job are
                 // conceptually the same so that's fine.
-                if let Some(rustc_tokens) = self.rustc_tokens.get_mut(&id) {
-                    self.tokens
-                        .push(rustc_tokens.pop().expect("rustc releases token it has"));
-                } else {
-                    panic!("This job does not have tokens associated with it");
-                }
+                let rustc_tokens = self
+                    .rustc_tokens
+                    .get_mut(&id)
+                    .expect("no tokens associated");
+                self.tokens
+                    .push(rustc_tokens.pop().expect("rustc releases token it has"));
             }
         }