refractor: use internal Intersect function.

This commit is contained in:
Alexandre Pujol 2024-06-19 23:55:45 +01:00
parent 3b82cc36ba
commit b0f6f15a9e
No known key found for this signature in database
GPG key ID: C5469996F0DF68EC
3 changed files with 69 additions and 3 deletions

View file

@ -8,7 +8,7 @@ import (
"slices"
"strings"
"github.com/samber/lo"
"github.com/roddhjav/apparmor.d/pkg/util"
)
type requirement map[string][]string
@ -225,7 +225,7 @@ func (r Rules) Format() Rules {
rule := r[i].(*File)
// Add padding to align with other transition rule
isTransition := lo.Intersect(transitions, rule.Access)
isTransition := util.Intersect(transitions, rule.Access)
if len(isTransition) > 0 {
ruleLen := len(rule.Path) + 1
paddingMaxLenght = max(ruleLen, paddingMaxLenght)
@ -265,7 +265,7 @@ func (r Rules) Format() Rules {
}
// Do not add new line on executable rule
isTransition := lo.Intersect(transitions, rule.Access)
isTransition := util.Intersect(transitions, rule.Access)
if len(isTransition) > 0 {
continue
}