refactor(optimizer): use match
to replace if else
#8291
Merged
match
to replace if else
#8291