Merge "Replace SetFlagsRule with CheckFlagsRule." into main