mirror of
https://github.com/prometheus/prometheus
synced 2026-04-30 23:11:34 +08:00
refactor: use slices.Equal to simplify code
Signed-off-by: wellweek <xiezitai@outlook.com>
This commit is contained in:
@@ -250,15 +250,7 @@ func (ls Labels) WithoutEmpty() Labels {
|
||||
|
||||
// Equal returns whether the two label sets are equal.
|
||||
func Equal(ls, o Labels) bool {
|
||||
if len(ls) != len(o) {
|
||||
return false
|
||||
}
|
||||
for i, l := range ls {
|
||||
if l != o[i] {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
return slices.Equal(ls, o)
|
||||
}
|
||||
|
||||
// EmptyLabels returns n empty Labels value, for convenience.
|
||||
|
||||
Reference in New Issue
Block a user