Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
Refinedrust Dev
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lennard Gäher
Refinedrust Dev
Commits
ea7cfe20
Verified
Commit
ea7cfe20
authored
11 months ago
by
Vincent Lafeychine
Browse files
Options
Downloads
Patches
Plain Diff
clippy: Fix manual_retain
parent
d6da9ecb
No related branches found
Branches containing commit
No related tags found
1 merge request
!38
Fix clippy::perf and most of clippy::nursery
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
rr_frontend/.cargo/config.toml
+0
-1
0 additions, 1 deletion
rr_frontend/.cargo/config.toml
rr_frontend/translation/src/environment/loops.rs
+13
-18
13 additions, 18 deletions
rr_frontend/translation/src/environment/loops.rs
with
13 additions
and
19 deletions
rr_frontend/.cargo/config.toml
+
0
−
1
View file @
ea7cfe20
...
...
@@ -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"
,
...
...
This diff is collapsed.
Click to expand it.
rr_frontend/translation/src/environment/loops.rs
+
13
−
18
View file @
ea7cfe20
...
...
@@ -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.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment