Minor runtime optimalization of rule_generator.