From f7ab89dc99dac93c24bdf938223d6539b3006513 Mon Sep 17 00:00:00 2001 From: Simone Date: Wed, 9 Aug 2023 17:57:30 +0200 Subject: [PATCH] Don't check unused returns for loop functions --- src/detectors/unused_return.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/detectors/unused_return.rs b/src/detectors/unused_return.rs index 2db732b..66cf387 100644 --- a/src/detectors/unused_return.rs +++ b/src/detectors/unused_return.rs @@ -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 {