Skip to content
Snippets Groups Projects
Verified Commit ea7cfe20 authored by Vincent Lafeychine's avatar Vincent Lafeychine
Browse files

clippy: Fix manual_retain

parent d6da9ecb
No related branches found
No related tags found
1 merge request!38Fix clippy::perf and most of clippy::nursery
......@@ -59,7 +59,6 @@ rustflags = [
"-Aclippy::unused_self",
# clippy::perf
"-Aclippy::manual_retain",
"-Aclippy::map_entry",
"-Aclippy::single_char_pattern",
"-Aclippy::to_string_in_format_args",
......
......@@ -475,24 +475,19 @@ impl ProcedureLoops {
debug!("accesses_pairs = {:?}", accesses_pairs);
if let Some(paths) = definitely_initalised_paths {
debug!("definitely_initalised_paths = {:?}", paths);
accesses_pairs = accesses_pairs
.into_iter()
.filter(|(place, kind)| {
paths.iter().any(|initialised_place|
// If the prefix is definitely initialised, then this place is a potential
// loop invariant.
utils::is_prefix(place, initialised_place) ||
// If the access is store, then we only need the path to exist, which is
// guaranteed if we have at least some of the leaves still initialised.
//
// Note that the Rust compiler is even more permissive as explained in this
// issue: https://github.com/rust-lang/rust/issues/21232.
(
*kind == PlaceAccessKind::Store &&
utils::is_prefix(initialised_place, place)
))
})
.collect();
accesses_pairs.retain(|(place, kind)| {
paths.iter().any(|initialised_place|
// If the prefix is definitely initialised, then this place is a potential
// loop invariant.
utils::is_prefix(place, initialised_place) ||
// If the access is store, then we only need the path to exist, which is
// guaranteed if we have at least some of the leaves still initialised.
//
// Note that the Rust compiler is even more permissive as explained in this
// issue: https://github.com/rust-lang/rust/issues/21232.
*kind == PlaceAccessKind::Store &&
utils::is_prefix(initialised_place, place))
});
}
debug!("accesses_pairs = {:?}", accesses_pairs);
// Paths to whose leaves we need write permissions.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment