From 3177dae00f264efbbd273fdffcd82b779884988b Mon Sep 17 00:00:00 2001 From: Andrey Gusakov Date: Wed, 7 May 2025 22:50:08 +0300 Subject: [PATCH] expected: compare UnexpectedCode if both are invalid From this: auto value = get(); if ((!value) && (value.Code == UnexpectedCode::Timeout)) To this: if (get() == UnexpectedCode::Timeout) --- util/include/rusefi/expected.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/util/include/rusefi/expected.h b/util/include/rusefi/expected.h index 00a846a..74d4b85 100644 --- a/util/include/rusefi/expected.h +++ b/util/include/rusefi/expected.h @@ -74,7 +74,10 @@ struct expected { // If both are invalid, they are equal if (!Valid && !other.Valid) { - return true; + if (Code == other.Code) { + return true; + } + return false; } // Both are guaranteed valid - simply compare values