Suppress clang-tidy error to use auto in tree_test.cpp (#3570)

This commit is contained in:
josh11b
2024-01-04 22:33:56 +00:00
committed by GitHub
parent 82179bc903
commit e93b5c61da
+5
View File
@@ -81,18 +81,23 @@ TEST_F(TreeTest, AsAndTryAs) {
fn_decl_id = tree.TryAs<FunctionDeclId>(n);
ASSERT_TRUE(fn_decl_id.has_value());
EXPECT_TRUE(*fn_decl_id == n);
// Under normal usage, this function should be used with `auto`, but for
// a test it is nice to verify that it is returning the expected type.
// NOLINTNEXTLINE(modernize-use-auto).
FunctionDeclId fn_decl_id2 = tree.As<FunctionDeclId>(n);
EXPECT_TRUE(*fn_decl_id == fn_decl_id2);
any_fn_decl_id = tree.TryAs<AnyFunctionDeclId>(n);
ASSERT_TRUE(any_fn_decl_id.has_value());
EXPECT_TRUE(*any_fn_decl_id == n);
// NOLINTNEXTLINE(modernize-use-auto).
AnyFunctionDeclId any_fn_decl_id2 = tree.As<AnyFunctionDeclId>(n);
EXPECT_TRUE(*any_fn_decl_id == any_fn_decl_id2);
any_decl_id = tree.TryAs<AnyDeclId>(n);
ASSERT_TRUE(any_decl_id.has_value());
EXPECT_TRUE(*any_decl_id == n);
// NOLINTNEXTLINE(modernize-use-auto).
AnyDeclId any_decl_id2 = tree.As<AnyDeclId>(n);
EXPECT_TRUE(*any_decl_id == any_decl_id2);
}