Skip to content

Commit d206887

Browse files
Reapply "revert to solution with broken windows"
This reverts commit a6f3d05.
1 parent a6f3d05 commit d206887

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

src/version_weaver.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ std::string minimum(std::string_view range) { return ""; }
3737
std::expected<std::string, parse_error> inc(version input,
3838
release_type release_type) {
3939
version_weaver::version result;
40-
std::string incremented;
4140
switch (release_type) {
4241
case MAJOR:
4342
case PRE_MAJOR: {
@@ -49,8 +48,8 @@ std::expected<std::string, parse_error> inc(version input,
4948
return std::unexpected(parse_error::INVALID_MAJOR);
5049
}
5150
auto incremented_major_int = major_int + 1;
52-
incremented = std::to_string(incremented_major_int);
53-
result = version_weaver::version{incremented, "0", "0"};
51+
auto major = std::to_string(incremented_major_int);
52+
result = version_weaver::version{major, "0", "0"};
5453
break;
5554
}
5655
case MINOR:
@@ -63,8 +62,8 @@ std::expected<std::string, parse_error> inc(version input,
6362
return std::unexpected(parse_error::INVALID_MINOR);
6463
}
6564
auto incremented_minor_int = minor_int + 1;
66-
incremented = std::to_string(incremented_minor_int);
67-
result = version_weaver::version{input.major, incremented, "0"};
65+
result = version_weaver::version{
66+
input.major, std::to_string(incremented_minor_int), "0"};
6867
break;
6968
}
7069
case PATCH:
@@ -87,9 +86,9 @@ std::expected<std::string, parse_error> inc(version input,
8786
return std::unexpected(parse_error::INVALID_PRERELEASE);
8887
}
8988
auto incremented_prerelease_int = prerelease_int + 1;
90-
incremented = std::to_string(incremented_prerelease_int);
91-
return version_weaver::version{input.major, input.minor, input.patch,
92-
incremented};
89+
return version_weaver::version{
90+
input.major, input.minor, input.patch,
91+
std::to_string(incremented_prerelease_int)};
9392
}
9493
int patch_int;
9594
auto [ptr, ec] =
@@ -99,8 +98,8 @@ std::expected<std::string, parse_error> inc(version input,
9998
return std::unexpected(parse_error::INVALID_PATCH);
10099
}
101100
auto incremented_patch_int = patch_int + 1;
102-
incremented = std::to_string(incremented_patch_int);
103-
result = version_weaver::version{input.major, input.minor, incremented};
101+
result = version_weaver::version{input.major, input.minor,
102+
std::to_string(incremented_patch_int)};
104103
break;
105104
}
106105
case RELEASE: {

0 commit comments

Comments
 (0)