@@ -48,7 +48,7 @@ enum QueryResult<D: DepKind> {
48
48
49
49
impl<K, D> QueryState<K, D>
50
50
where
51
- K: Eq + Hash + Clone + Debug,
51
+ K: Eq + Hash + Copy + Debug,
52
52
D: DepKind,
53
53
{
54
54
pub fn all_inactive(&self) -> bool {
77
77
for shard in shards.iter() {
78
78
for (k, v) in shard.iter() {
79
79
if let QueryResult::Started(ref job) = *v {
80
- let query = make_query(qcx, k.clone() );
80
+ let query = make_query(qcx, *k );
81
81
jobs.insert(job.id, QueryJobInfo { query, job: job.clone() });
82
82
}
83
83
}
91
91
// really hurt much.)
92
92
for (k, v) in self.active.try_lock()?.iter() {
93
93
if let QueryResult::Started(ref job) = *v {
94
- let query = make_query(qcx, k.clone() );
94
+ let query = make_query(qcx, *k );
95
95
jobs.insert(job.id, QueryJobInfo { query, job: job.clone() });
96
96
}
97
97
}
@@ -111,7 +111,7 @@ impl<K, D: DepKind> Default for QueryState<K, D> {
111
111
/// This will poison the relevant query if dropped.
112
112
struct JobOwner<'tcx, K, D: DepKind>
113
113
where
114
- K: Eq + Hash + Clone ,
114
+ K: Eq + Hash + Copy ,
115
115
{
116
116
state: &'tcx QueryState<K, D>,
117
117
key: K,
@@ -163,7 +163,7 @@ where
163
163
164
164
impl<'tcx, K, D: DepKind> JobOwner<'tcx, K, D>
165
165
where
166
- K: Eq + Hash + Clone ,
166
+ K: Eq + Hash + Copy ,
167
167
{
168
168
/// Either gets a `JobOwner` corresponding the query, allowing us to
169
169
/// start executing the query, or returns with the result of the query.
@@ -195,7 +195,7 @@ where
195
195
let job = qcx.current_query_job();
196
196
let job = QueryJob::new(id, span, job);
197
197
198
- let key = entry.key().clone ();
198
+ let key = * entry.key();
199
199
entry.insert(QueryResult::Started(job));
200
200
201
201
let owner = JobOwner { state, id, key };
@@ -274,7 +274,7 @@ where
274
274
275
275
impl<'tcx, K, D> Drop for JobOwner<'tcx, K, D>
276
276
where
277
- K: Eq + Hash + Clone ,
277
+ K: Eq + Hash + Copy ,
278
278
D: DepKind,
279
279
{
280
280
#[inline(never)]
@@ -291,7 +291,7 @@ where
291
291
QueryResult::Started(job) => job,
292
292
QueryResult::Poisoned => panic!(),
293
293
};
294
- shard.insert(self.key.clone() , QueryResult::Poisoned);
294
+ shard.insert(self.key, QueryResult::Poisoned);
295
295
job
296
296
};
297
297
// Also signal the completion of the job, so waiters
@@ -310,7 +310,7 @@ pub(crate) struct CycleError<D: DepKind> {
310
310
/// The result of `try_start`.
311
311
enum TryGetJob<'tcx, K, D>
312
312
where
313
- K: Eq + Hash + Clone ,
313
+ K: Eq + Hash + Copy ,
314
314
D: DepKind,
315
315
{
316
316
/// The query is not yet started. Contains a guard to the cache eventually used to start it.
@@ -358,10 +358,9 @@ where
358
358
Q: QueryConfig<Qcx>,
359
359
Qcx: QueryContext,
360
360
{
361
- match JobOwner::<'_, Q::Key, Qcx::DepKind>::try_start(&qcx, state, span, key.clone() ) {
361
+ match JobOwner::<'_, Q::Key, Qcx::DepKind>::try_start(&qcx, state, span, key) {
362
362
TryGetJob::NotYetStarted(job) => {
363
- let (result, dep_node_index) =
364
- execute_job::<Q, Qcx>(qcx, key.clone(), dep_node, job.id);
363
+ let (result, dep_node_index) = execute_job::<Q, Qcx>(qcx, key, dep_node, job.id);
365
364
if Q::FEEDABLE {
366
365
// We should not compute queries that also got a value via feeding.
367
366
// This can't happen, as query feeding adds the very dependencies to the fed query
@@ -551,7 +550,7 @@ where
551
550
let prof_timer = qcx.dep_context().profiler().query_provider();
552
551
553
552
// The dep-graph for this computation is already in-place.
554
- let result = dep_graph.with_ignore(|| Q::compute(qcx, key.clone() ));
553
+ let result = dep_graph.with_ignore(|| Q::compute(qcx, * key));
555
554
556
555
prof_timer.finish_with_query_invocation_id(dep_node_index.into());
557
556
0 commit comments