diff options
| author | ljedrz <ljedrz@gmail.com> | 2018-12-19 13:19:48 +0100 |
|---|---|---|
| committer | ljedrz <ljedrz@gmail.com> | 2018-12-19 15:15:24 +0100 |
| commit | c2fa99d2c6671ef9771df76335f6b528847e598c (patch) | |
| tree | 788e8a0a5d5b8aab10f17f57785f45dcd0004045 | |
| parent | d7ca0758812daa1e796a6f58a1fb3fe98cf88fa6 (diff) | |
| download | rust-c2fa99d2c6671ef9771df76335f6b528847e598c.tar.gz rust-c2fa99d2c6671ef9771df76335f6b528847e598c.zip | |
query: minor refactoring
| -rw-r--r-- | src/librustc/ty/query/job.rs | 7 | ||||
| -rw-r--r-- | src/librustc/ty/query/on_disk_cache.rs | 6 |
2 files changed, 3 insertions, 10 deletions
diff --git a/src/librustc/ty/query/job.rs b/src/librustc/ty/query/job.rs index 559093b8f18..4ee5ef6b1fd 100644 --- a/src/librustc/ty/query/job.rs +++ b/src/librustc/ty/query/job.rs @@ -406,7 +406,7 @@ fn remove_cycle<'tcx>( // Find the queries in the cycle which are // connected to queries outside the cycle - let entry_points: Vec<_> = stack.iter().filter_map(|(span, query)| { + let entry_points = stack.iter().filter_map(|(span, query)| { if query.parent.is_none() { // This query is connected to the root (it has no query parent) Some((*span, query.clone(), None)) @@ -431,10 +431,7 @@ fn remove_cycle<'tcx>( Some((*span, query.clone(), Some(waiter))) } } - }).collect(); - - let entry_points: Vec<(Span, Lrc<QueryJob<'tcx>>, Option<(Span, Lrc<QueryJob<'tcx>>)>)> - = entry_points; + }).collect::<Vec<(Span, Lrc<QueryJob<'tcx>>, Option<(Span, Lrc<QueryJob<'tcx>>)>)>>(); // Deterministically pick an entry point let (_, entry_point, usage) = pick_query(tcx, &entry_points, |e| (e.0, e.1.clone())); diff --git a/src/librustc/ty/query/on_disk_cache.rs b/src/librustc/ty/query/on_disk_cache.rs index 04c880826fe..94456e3e773 100644 --- a/src/librustc/ty/query/on_disk_cache.rs +++ b/src/librustc/ty/query/on_disk_cache.rs @@ -398,11 +398,7 @@ impl<'sess> OnDiskCache<'sess> { -> Option<T> where T: Decodable { - let pos = if let Some(&pos) = index.get(&dep_node_index) { - pos - } else { - return None - }; + let pos = index.get(&dep_node_index).cloned()?; // Initialize the cnum_map using the value from the thread which finishes the closure first self.cnum_map.init_nonlocking_same(|| { |
