[core] Remove some unreachable code