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 = [ ...@@ -59,7 +59,6 @@ rustflags = [
"-Aclippy::unused_self", "-Aclippy::unused_self",
# clippy::perf # clippy::perf
"-Aclippy::manual_retain",
"-Aclippy::map_entry", "-Aclippy::map_entry",
"-Aclippy::single_char_pattern", "-Aclippy::single_char_pattern",
"-Aclippy::to_string_in_format_args", "-Aclippy::to_string_in_format_args",
......
...@@ -475,24 +475,19 @@ impl ProcedureLoops { ...@@ -475,24 +475,19 @@ impl ProcedureLoops {
debug!("accesses_pairs = {:?}", accesses_pairs); debug!("accesses_pairs = {:?}", accesses_pairs);
if let Some(paths) = definitely_initalised_paths { if let Some(paths) = definitely_initalised_paths {
debug!("definitely_initalised_paths = {:?}", paths); debug!("definitely_initalised_paths = {:?}", paths);
accesses_pairs = accesses_pairs accesses_pairs.retain(|(place, kind)| {
.into_iter() paths.iter().any(|initialised_place|
.filter(|(place, kind)| { // If the prefix is definitely initialised, then this place is a potential
paths.iter().any(|initialised_place| // loop invariant.
// If the prefix is definitely initialised, then this place is a potential utils::is_prefix(place, initialised_place) ||
// loop invariant. // If the access is store, then we only need the path to exist, which is
utils::is_prefix(place, initialised_place) || // guaranteed if we have at least some of the leaves still initialised.
// 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.
// Note that the Rust compiler is even more permissive as explained in this *kind == PlaceAccessKind::Store &&
// issue: https://github.com/rust-lang/rust/issues/21232. utils::is_prefix(initialised_place, place))
( });
*kind == PlaceAccessKind::Store &&
utils::is_prefix(initialised_place, place)
))
})
.collect();
} }
debug!("accesses_pairs = {:?}", accesses_pairs); debug!("accesses_pairs = {:?}", accesses_pairs);
// Paths to whose leaves we need write permissions. // 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