From b5fc93f4e2ccd43a18d14251658bf8bf6a8377ee Mon Sep 17 00:00:00 2001 From: Kentaro Hayashi Date: Tue, 24 Sep 2024 10:13:38 +0900 Subject: [PATCH] Use each instead of each_with_index (#4641) It is trivial, but apparently index is not used at all in this method. Signed-off-by: Kentaro Hayashi --- lib/fluent/event_router.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/fluent/event_router.rb b/lib/fluent/event_router.rb index 9a133b5c6b..bfc192ff0a 100644 --- a/lib/fluent/event_router.rb +++ b/lib/fluent/event_router.rb @@ -286,7 +286,7 @@ def reset_optimization def find(tag) pipeline = nil - @match_rules.each_with_index { |rule, i| + @match_rules.each do |rule| if rule.match?(tag) if rule.collector.is_a?(Plugin::Filter) pipeline ||= Pipeline.new @@ -301,7 +301,7 @@ def find(tag) return pipeline end end - } + end if pipeline # filter is matched but no match