diff --git a/base/expected_test.cpp b/base/expected_test.cpp index a74bc1dec..6c3d42130 100644 --- a/base/expected_test.cpp +++ b/base/expected_test.cpp @@ -499,24 +499,6 @@ TEST(Expected, testDifferentErrors) { EXPECT_TRUE(e4 != e3); } -TEST(Expected, testCompareWithSameValue) { - exp_int e = 10; - int value = 10; - EXPECT_TRUE(e == value); - EXPECT_TRUE(value == e); - EXPECT_FALSE(e != value); - EXPECT_FALSE(value != e); -} - -TEST(Expected, testCompareWithDifferentValue) { - exp_int e = 10; - int value = 20; - EXPECT_FALSE(e == value); - EXPECT_FALSE(value == e); - EXPECT_TRUE(e != value); - EXPECT_TRUE(value != e); -} - TEST(Expected, testCompareWithSameError) { exp_int e = unexpected(10); exp_int::unexpected_type error = 10; @@ -594,7 +576,7 @@ TEST(Expected, testDivideExample) { EXPECT_EQ(-1, divide(10, 0).error().cause); EXPECT_TRUE(divide(10, 3)); - EXPECT_EQ(QR(3, 1), divide(10, 3)); + EXPECT_EQ(QR(3, 1), *divide(10, 3)); } TEST(Expected, testPair) { diff --git a/base/include/android-base/expected.h b/base/include/android-base/expected.h index b3f5adb43..44e0b4acb 100644 --- a/base/include/android-base/expected.h +++ b/base/include/android-base/expected.h @@ -366,16 +366,6 @@ class _NODISCARD_ expected { template friend constexpr bool operator!=(const expected& x, const expected& y); - // comparison with T - template - friend constexpr bool operator==(const expected&, const T2&); - template - friend constexpr bool operator==(const T2&, const expected&); - template - friend constexpr bool operator!=(const expected&, const T2&); - template - friend constexpr bool operator!=(const T2&, const expected&); - // Comparison with unexpected template friend constexpr bool operator==(const expected&, const unexpected&); @@ -410,24 +400,6 @@ constexpr bool operator!=(const expected& x, const expected& y) return !(x == y); } -// comparison with T -template -constexpr bool operator==(const expected& x, const T2& y) { - return x.has_value() && (*x == y); -} -template -constexpr bool operator==(const T2& x, const expected& y) { - return y.has_value() && (x == *y); -} -template -constexpr bool operator!=(const expected& x, const T2& y) { - return !x.has_value() || (*x != y); -} -template -constexpr bool operator!=(const T2& x, const expected& y) { - return !y.has_value() || (x != *y); -} - // Comparison with unexpected template constexpr bool operator==(const expected& x, const unexpected& y) { diff --git a/init/service_parser.cpp b/init/service_parser.cpp index 1d431e3a6..3f817921f 100644 --- a/init/service_parser.cpp +++ b/init/service_parser.cpp @@ -208,7 +208,7 @@ Result ServiceParser::ParseKeycodes(std::vector&& args) { // If the property is not set, it defaults to none, in which case there are no keycodes // for this service. - if (expanded == "none") { + if (*expanded == "none") { return {}; }