Skip to content

Commit c2fa99d

Browse files
committed
query: minor refactoring
1 parent d7ca075 commit c2fa99d

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

src/librustc/ty/query/job.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ fn remove_cycle<'tcx>(
406406

407407
// Find the queries in the cycle which are
408408
// connected to queries outside the cycle
409-
let entry_points: Vec<_> = stack.iter().filter_map(|(span, query)| {
409+
let entry_points = stack.iter().filter_map(|(span, query)| {
410410
if query.parent.is_none() {
411411
// This query is connected to the root (it has no query parent)
412412
Some((*span, query.clone(), None))
@@ -431,10 +431,7 @@ fn remove_cycle<'tcx>(
431431
Some((*span, query.clone(), Some(waiter)))
432432
}
433433
}
434-
}).collect();
435-
436-
let entry_points: Vec<(Span, Lrc<QueryJob<'tcx>>, Option<(Span, Lrc<QueryJob<'tcx>>)>)>
437-
= entry_points;
434+
}).collect::<Vec<(Span, Lrc<QueryJob<'tcx>>, Option<(Span, Lrc<QueryJob<'tcx>>)>)>>();
438435

439436
// Deterministically pick an entry point
440437
let (_, entry_point, usage) = pick_query(tcx, &entry_points, |e| (e.0, e.1.clone()));

src/librustc/ty/query/on_disk_cache.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -398,11 +398,7 @@ impl<'sess> OnDiskCache<'sess> {
398398
-> Option<T>
399399
where T: Decodable
400400
{
401-
let pos = if let Some(&pos) = index.get(&dep_node_index) {
402-
pos
403-
} else {
404-
return None
405-
};
401+
let pos = index.get(&dep_node_index).cloned()?;
406402

407403
// Initialize the cnum_map using the value from the thread which finishes the closure first
408404
self.cnum_map.init_nonlocking_same(|| {

0 commit comments

Comments
 (0)