1
Fork 0

Fix clippy::needless_borrow in the compiler

`x clippy compiler -Aclippy::all -Wclippy::needless_borrow --fix`.

Then I had to remove a few unnecessary parens and muts that were exposed
now.
This commit is contained in:
Nilstrieb 2023-11-21 20:07:32 +01:00
parent 0ff8610964
commit 21a870515b
304 changed files with 1101 additions and 1174 deletions

View file

@ -743,7 +743,7 @@ impl<D: Deps> DepGraphData<D> {
// in the previous compilation session too, so we can try to
// mark it as green by recursively marking all of its
// dependencies green.
self.try_mark_previous_green(qcx, prev_index, &dep_node, None)
self.try_mark_previous_green(qcx, prev_index, dep_node, None)
.map(|dep_node_index| (prev_index, dep_node_index))
}
}

View file

@ -220,7 +220,7 @@ where
C: QueryCache,
Tcx: DepContext,
{
match cache.lookup(&key) {
match cache.lookup(key) {
Some((value, index)) => {
tcx.profiler().query_cache_hit(index.into());
tcx.dep_graph().read_index(index);
@ -502,7 +502,7 @@ where
// The diagnostics for this query will be promoted to the current session during
// `try_mark_green()`, so we can ignore them here.
if let Some(ret) = qcx.start_query(job_id, false, None, || {
try_load_from_disk_and_cache_in_memory(query, dep_graph_data, qcx, &key, &dep_node)
try_load_from_disk_and_cache_in_memory(query, dep_graph_data, qcx, &key, dep_node)
}) {
return ret;
}
@ -563,7 +563,7 @@ where
// Note this function can be called concurrently from the same query
// We must ensure that this is handled correctly.
let (prev_dep_node_index, dep_node_index) = dep_graph_data.try_mark_green(qcx, &dep_node)?;
let (prev_dep_node_index, dep_node_index) = dep_graph_data.try_mark_green(qcx, dep_node)?;
debug_assert!(dep_graph_data.is_index_green(prev_dep_node_index));
@ -610,7 +610,7 @@ where
// Sanity check for the logic in `ensure`: if the node is green and the result loadable,
// we should actually be able to load it.
debug_assert!(
!query.loadable_from_disk(qcx, &key, prev_dep_node_index),
!query.loadable_from_disk(qcx, key, prev_dep_node_index),
"missing on-disk cache entry for loadable {dep_node:?}"
);
@ -667,7 +667,7 @@ pub(crate) fn incremental_verify_ich<Tcx, V>(
let old_hash = dep_graph_data.prev_fingerprint_of(prev_index);
if new_hash != old_hash {
incremental_verify_ich_failed(tcx, prev_index, &|| format_value(&result));
incremental_verify_ich_failed(tcx, prev_index, &|| format_value(result));
}
}