Merge similar rules into one line.