Reorganize rstate so lint can infer the return value easier.