Switch to trailing returns in toolchain and related code. (#4919)

Also makes the style guide explicitly comment on void, but this was the
intent IIRC because it matches Carbon's `-> ()` (and "always" versus
"except for void", which we definitely went back and forth on).

Includes adjusting function pointers, which I definitely forget this
syntax works sometimes.

Excludes utils/tree_sitter/src/scanner.c because it claims to be C, but
really we should probably fix that to be cpp.
This commit is contained in:
Jon Ross-Perkins
2025-02-11 18:11:14 +00:00
committed by GitHub
parent 316a6c59e9
commit 2fef1cb713
38 changed files with 289 additions and 251 deletions
+4 -3
View File
@@ -21,7 +21,7 @@ using RawHashtable::TestData;
using ::testing::UnorderedElementsAreArray;
template <typename SetT, typename MatcherRangeT>
void ExpectSetElementsAre(SetT&& s, MatcherRangeT element_matchers) {
auto ExpectSetElementsAre(SetT&& s, MatcherRangeT element_matchers) -> void {
// Collect the elements into a container.
using KeyT = typename std::remove_reference<SetT>::type::KeyT;
std::vector<KeyT> entries;
@@ -34,8 +34,9 @@ void ExpectSetElementsAre(SetT&& s, MatcherRangeT element_matchers) {
// Allow directly using an initializer list.
template <typename SetT, typename MatcherT>
void ExpectSetElementsAre(SetT&& s,
std::initializer_list<MatcherT> element_matchers) {
auto ExpectSetElementsAre(SetT&& s,
std::initializer_list<MatcherT> element_matchers)
-> void {
std::vector<MatcherT> element_matchers_storage = element_matchers;
ExpectSetElementsAre(s, element_matchers_storage);
}