avoid extra clone
This commit is contained in:
parent
4038b5b3ee
commit
af4a0e8e05
@ -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()));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user