[pmg-devel] [PATCH pmg-log-tracker 1/3] fix filter_matches() if condition

Mira Limbeck m.limbeck at proxmox.com
Thu Apr 2 16:57:12 CEST 2020


We need to check the filter entries when either the 'from' or 'to'
options are set. Also remove the && is_filtered as it is superfluous.

The !is_filtered check lead to all filter entries being printed all the
time.

Signed-off-by: Mira Limbeck <m.limbeck at proxmox.com>
---
 src/main.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main.rs b/src/main.rs
index 6dfd951..fa75f01 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -868,7 +868,7 @@ impl SEntry {
                 let from_match = !parser.options.from.is_empty()
                     && find_lowercase(&self.bq_from, parser.options.from.as_bytes()).is_some();
                 let to_option_set = !parser.options.to.is_empty();
-                if !is_filtered && fe.borrow().is_bq && !fe.borrow().is_accepted {
+                if is_filtered && fe.borrow().is_bq && !fe.borrow().is_accepted {
                     for to in fe.borrow().to_entries.iter() {
                         if from_match
                             || (to_option_set
@@ -878,7 +878,7 @@ impl SEntry {
                             break;
                         }
                     }
-                    if !found && is_filtered {
+                    if !found {
                         return false;
                     }
                 }
-- 
2.20.1




More information about the pmg-devel mailing list