Skip to content

Commit

Permalink
Don't check unused returns for loop functions
Browse files Browse the repository at this point in the history
  • Loading branch information
smonicas committed Aug 9, 2023
1 parent 9ee2a0b commit f7ab89d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/detectors/unused_return.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ impl Detector for UnusedReturn {
f.name() == f_called.function.id.debug_name.clone().unwrap()
}) {
// We don't check for unused return in case of Storage functions
if f.ty() == &Type::Storage {
// When a loop function is called in sierra and in that function
// an array is emptied with pop_front this array is dropped
// when returning from the function call and it would be incorrectly
// reported as unused-return
if matches!(f.ty(), &Type::Storage | &Type::Loop) {
continue;
}
} else {
Expand Down

0 comments on commit f7ab89d

Please sign in to comment.