From 0fdaf263c1982d894266976a8200810c7b73cb2c Mon Sep 17 00:00:00 2001 From: Fabian Reinartz Date: Mon, 28 Sep 2015 22:08:47 +0200 Subject: [PATCH] Simplify inhibition mute check --- inhibit.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/inhibit.go b/inhibit.go index 2b538382..0193756e 100644 --- a/inhibit.go +++ b/inhibit.go @@ -110,15 +110,14 @@ func NewInhibitRule(cr *config.InhibitRule) *InhibitRule { } func (r *InhibitRule) Mutes(source, target model.LabelSet) bool { - if r.TargetMatchers.Match(target) && r.SourceMatchers.Match(source) { - for ln := range r.Equal { - if source[ln] != target[ln] { - return false - } - } - } else { + if !r.TargetMatchers.Match(target) || !r.SourceMatchers.Match(source) { return false } + for ln := range r.Equal { + if source[ln] != target[ln] { + return false + } + } return true }