fix: Remaining clang-tidy unchecked optionals (#6979)

This commit is contained in:
Alex Kremer
2026-04-23 17:21:01 +01:00
committed by GitHub
parent 7cd503859e
commit 19da25812b
40 changed files with 240 additions and 63 deletions

View File

@@ -6354,8 +6354,11 @@ private:
// CLOB and AMM, AMM is not selected
if (i == 2)
{
// NOLINTBEGIN(bugprone-unchecked-optional-access) i==2 implies amm is
// emplaced (i>0)
BEAST_EXPECT(amm->expectBalances(
USD(1'000'000'000), ETH(1'000'000'000), amm->tokens()));
// NOLINTEND(bugprone-unchecked-optional-access)
}
env.require(balance(bob, USD(2'100'000'000)));
q[i] = Quality(
@@ -6393,8 +6396,10 @@ private:
// AMM is not selected
if (i > 0)
{
// NOLINTBEGIN(bugprone-unchecked-optional-access) emplaced when i > 0
BEAST_EXPECT(
amm->expectBalances(USD(1'000'000'000), ETH(1'000'000'000), amm->tokens()));
// NOLINTEND(bugprone-unchecked-optional-access)
}
if (i == 0 || i == 2)
{
@@ -6438,8 +6443,10 @@ private:
// AMM and CLOB are selected
if (i > 0)
{
// NOLINTBEGIN(bugprone-unchecked-optional-access) emplaced when i > 0
BEAST_EXPECT(!amm->expectBalances(
USD(1'000'000'000), ETH(1'000'000'000), amm->tokens()));
// NOLINTEND(bugprone-unchecked-optional-access)
}
if (i == 2)
@@ -6500,8 +6507,10 @@ private:
// AMM is selected in both cases
if (i > 0)
{
// NOLINTBEGIN(bugprone-unchecked-optional-access) emplaced when i > 0
BEAST_EXPECT(!amm->expectBalances(
USD(1'000'000'000), ETH(1'000'000'000), amm->tokens()));
// NOLINTEND(bugprone-unchecked-optional-access)
}
// Partially crosses, AMM is selected, CLOB fails
// limitQuality
@@ -6584,6 +6593,8 @@ private:
if (i == 2)
{
// NOLINTBEGIN(bugprone-unchecked-optional-access) i==2 implies amm is
// emplaced (i>0)
if (rates.first == lowRate)
{
// Liquidity is consumed from AMM strand only
@@ -6607,6 +6618,7 @@ private:
USD(281'976'305),
}}}));
}
// NOLINTEND(bugprone-unchecked-optional-access)
}
q[i] = Quality(
Amounts{