Mark default switch cases as UNREACHABLE.

GitOrigin-RevId: 8d17b9d6981f23d45d140b0f5deaa12cff734abb
This commit is contained in:
levlam 2018-09-05 21:07:50 +03:00
parent a9608ca379
commit e7929ac51e
2 changed files with 8 additions and 8 deletions

View File

@ -106,6 +106,8 @@ Status RawConnection::flush_read(const AuthKey &auth_key, Callback &callback) {
}
case mtproto::Transport::ReadResult::Nop:
break;
default:
UNREACHABLE();
}
}

View File

@ -851,19 +851,17 @@ Result<std::tuple<uint64, BufferSlice, int32>> SecretChatActor::decrypt(BufferSl
}
TRY_RESULT(read_result, std::move(r_read_result));
switch (read_result.type()) {
case mtproto::Transport::ReadResult::Quickack: {
case mtproto::Transport::ReadResult::Quickack:
return Status::Error("Got quickack instead of a message");
}
case mtproto::Transport::ReadResult::Error: {
case mtproto::Transport::ReadResult::Error:
return Status::Error(PSLICE() << "Got mtproto error code instead of a message: " << read_result.error());
}
case mtproto::Transport::ReadResult::Nop: {
case mtproto::Transport::ReadResult::Nop:
return Status::Error("Got nop instead of a message");
}
case mtproto::Transport::ReadResult::Packet: {
case mtproto::Transport::ReadResult::Packet:
data = read_result.packet();
break;
}
default:
UNREACHABLE();
}
auto len = as<int32>(data.begin());