Skip to content

Commit 6e8d8b3

Browse files
committed
Put return type in function body to clarify initialization
1 parent 989435a commit 6e8d8b3

File tree

7 files changed

+31
-31
lines changed

7 files changed

+31
-31
lines changed

include/graphqlservice/introspection/IntrospectionSchema.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ enum class TypeKind
3434
NON_NULL
3535
};
3636

37-
constexpr std::array<std::string_view, 8> getTypeKindNames() noexcept
37+
constexpr auto getTypeKindNames() noexcept
3838
{
3939
using namespace std::literals;
4040

41-
return { {
41+
return std::array<std::string_view, 8> {
4242
R"gql(SCALAR)gql"sv,
4343
R"gql(OBJECT)gql"sv,
4444
R"gql(INTERFACE)gql"sv,
@@ -47,7 +47,7 @@ constexpr std::array<std::string_view, 8> getTypeKindNames() noexcept
4747
R"gql(INPUT_OBJECT)gql"sv,
4848
R"gql(LIST)gql"sv,
4949
R"gql(NON_NULL)gql"sv
50-
} };
50+
};
5151
}
5252

5353
enum class DirectiveLocation
@@ -73,11 +73,11 @@ enum class DirectiveLocation
7373
INPUT_FIELD_DEFINITION
7474
};
7575

76-
constexpr std::array<std::string_view, 19> getDirectiveLocationNames() noexcept
76+
constexpr auto getDirectiveLocationNames() noexcept
7777
{
7878
using namespace std::literals;
7979

80-
return { {
80+
return std::array<std::string_view, 19> {
8181
R"gql(QUERY)gql"sv,
8282
R"gql(MUTATION)gql"sv,
8383
R"gql(SUBSCRIPTION)gql"sv,
@@ -97,7 +97,7 @@ constexpr std::array<std::string_view, 19> getDirectiveLocationNames() noexcept
9797
R"gql(ENUM_VALUE)gql"sv,
9898
R"gql(INPUT_OBJECT)gql"sv,
9999
R"gql(INPUT_FIELD_DEFINITION)gql"sv
100-
} };
100+
};
101101
}
102102

103103
class Schema;

samples/learn/schema/StarWarsSchema.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ enum class Episode
2929
JEDI
3030
};
3131

32-
constexpr std::array<std::string_view, 3> getEpisodeNames() noexcept
32+
constexpr auto getEpisodeNames() noexcept
3333
{
3434
using namespace std::literals;
3535

36-
return { {
36+
return std::array<std::string_view, 3> {
3737
R"gql(NEW_HOPE)gql"sv,
3838
R"gql(EMPIRE)gql"sv,
3939
R"gql(JEDI)gql"sv
40-
} };
40+
};
4141
}
4242

4343
struct ReviewInput

samples/today/nointrospection/TodaySchema.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,16 @@ enum class TaskState
3030
Unassigned
3131
};
3232

33-
constexpr std::array<std::string_view, 4> getTaskStateNames() noexcept
33+
constexpr auto getTaskStateNames() noexcept
3434
{
3535
using namespace std::literals;
3636

37-
return { {
37+
return std::array<std::string_view, 4> {
3838
R"gql(New)gql"sv,
3939
R"gql(Started)gql"sv,
4040
R"gql(Complete)gql"sv,
4141
R"gql(Unassigned)gql"sv
42-
} };
42+
};
4343
}
4444

4545
struct CompleteTaskInput

samples/today/schema/TodaySchema.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,16 @@ enum class TaskState
3030
Unassigned
3131
};
3232

33-
constexpr std::array<std::string_view, 4> getTaskStateNames() noexcept
33+
constexpr auto getTaskStateNames() noexcept
3434
{
3535
using namespace std::literals;
3636

37-
return { {
37+
return std::array<std::string_view, 4> {
3838
R"gql(New)gql"sv,
3939
R"gql(Started)gql"sv,
4040
R"gql(Complete)gql"sv,
4141
R"gql(Unassigned)gql"sv
42-
} };
42+
};
4343
}
4444

4545
struct CompleteTaskInput

samples/validation/schema/ValidationSchema.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,29 +29,29 @@ enum class DogCommand
2929
HEEL
3030
};
3131

32-
constexpr std::array<std::string_view, 3> getDogCommandNames() noexcept
32+
constexpr auto getDogCommandNames() noexcept
3333
{
3434
using namespace std::literals;
3535

36-
return { {
36+
return std::array<std::string_view, 3> {
3737
R"gql(SIT)gql"sv,
3838
R"gql(DOWN)gql"sv,
3939
R"gql(HEEL)gql"sv
40-
} };
40+
};
4141
}
4242

4343
enum class CatCommand
4444
{
4545
JUMP
4646
};
4747

48-
constexpr std::array<std::string_view, 1> getCatCommandNames() noexcept
48+
constexpr auto getCatCommandNames() noexcept
4949
{
5050
using namespace std::literals;
5151

52-
return { {
52+
return std::array<std::string_view, 1> {
5353
R"gql(JUMP)gql"sv
54-
} };
54+
};
5555
}
5656

5757
struct ComplexInput

src/SchemaGenerator.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,13 +175,13 @@ static_assert(graphql::internal::MinorVersion == )cpp"
175175
176176
)cpp";
177177

178-
headerFile << R"cpp(constexpr std::array<std::string_view, )cpp"
179-
<< enumType.values.size() << R"cpp(> get)cpp" << enumType.cppType
178+
headerFile << R"cpp(constexpr auto get)cpp" << enumType.cppType
180179
<< R"cpp(Names() noexcept
181180
{
182181
using namespace std::literals;
183182
184-
return { {
183+
return std::array<std::string_view, )cpp"
184+
<< enumType.values.size() << R"cpp(> {
185185
)cpp";
186186

187187
firstValue = true;
@@ -199,7 +199,7 @@ static_assert(graphql::internal::MinorVersion == )cpp"
199199
}
200200

201201
headerFile << R"cpp(
202-
} };
202+
};
203203
}
204204
205205
)cpp";

src/introspection/IntrospectionSchema.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ enum class TypeKind
3434
NON_NULL
3535
};
3636

37-
constexpr std::array<std::string_view, 8> getTypeKindNames() noexcept
37+
constexpr auto getTypeKindNames() noexcept
3838
{
3939
using namespace std::literals;
4040

41-
return { {
41+
return std::array<std::string_view, 8> {
4242
R"gql(SCALAR)gql"sv,
4343
R"gql(OBJECT)gql"sv,
4444
R"gql(INTERFACE)gql"sv,
@@ -47,7 +47,7 @@ constexpr std::array<std::string_view, 8> getTypeKindNames() noexcept
4747
R"gql(INPUT_OBJECT)gql"sv,
4848
R"gql(LIST)gql"sv,
4949
R"gql(NON_NULL)gql"sv
50-
} };
50+
};
5151
}
5252

5353
enum class DirectiveLocation
@@ -73,11 +73,11 @@ enum class DirectiveLocation
7373
INPUT_FIELD_DEFINITION
7474
};
7575

76-
constexpr std::array<std::string_view, 19> getDirectiveLocationNames() noexcept
76+
constexpr auto getDirectiveLocationNames() noexcept
7777
{
7878
using namespace std::literals;
7979

80-
return { {
80+
return std::array<std::string_view, 19> {
8181
R"gql(QUERY)gql"sv,
8282
R"gql(MUTATION)gql"sv,
8383
R"gql(SUBSCRIPTION)gql"sv,
@@ -97,7 +97,7 @@ constexpr std::array<std::string_view, 19> getDirectiveLocationNames() noexcept
9797
R"gql(ENUM_VALUE)gql"sv,
9898
R"gql(INPUT_OBJECT)gql"sv,
9999
R"gql(INPUT_FIELD_DEFINITION)gql"sv
100-
} };
100+
};
101101
}
102102

103103
class Schema;

0 commit comments

Comments
 (0)