about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2016-06-03 20:39:43 -0400
committerNiko Matsakis <niko@alum.mit.edu>2016-06-03 20:39:43 -0400
commitaf4a0e8e0569ecf83278df437f504b63678e8710 (patch)
treeb87fc36a8cf8843802cfaee9e4840876358333fd /src
parent4038b5b3eee3d26e07ec49b2e697975307488d67 (diff)
avoid extra clone
Diffstat (limited to 'src')
-rw-r--r--src/librustc/dep_graph/raii.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/librustc/dep_graph/raii.rs b/src/librustc/dep_graph/raii.rs
index 92cecabaa18..c43d493d176 100644
--- a/src/librustc/dep_graph/raii.rs
+++ b/src/librustc/dep_graph/raii.rs
@@ -14,20 +14,20 @@ use super::thread::{DepGraphThreadData, DepMessage};
 
 pub struct DepTask<'graph> {
     data: &'graph DepGraphThreadData,
-    key: DepNode<DefId>,
+    key: Option<DepNode<DefId>>,
 }
 
 impl<'graph> DepTask<'graph> {
     pub fn new(data: &'graph DepGraphThreadData, key: DepNode<DefId>)
                -> DepTask<'graph> {
         data.enqueue(DepMessage::PushTask(key.clone()));
-        DepTask { data: data, key: key }
+        DepTask { data: data, key: Some(key) }
     }
 }
 
 impl<'graph> Drop for DepTask<'graph> {
     fn drop(&mut self) {
-        self.data.enqueue(DepMessage::PopTask(self.key.clone()));
+        self.data.enqueue(DepMessage::PopTask(self.key.take().unwrap()));
     }
 }