[gardening] Remove redundant repetition of type names (DRY): RepeatedTypeName foo = dyn_cast<RepeatedTypeName>(bar)

Replace `NameOfType foo = dyn_cast<NameOfType>(bar)` with DRY version `auto foo = dyn_cast<NameOfType>(bar)`.

The DRY auto version is by far the dominant form already used in the repo, so this PR merely brings the exceptional cases (redundant repetition form) in line with the dominant form (auto form).

See the [C++ Core Guidelines](https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#es11-use-auto-to-avoid-redundant-repetition-of-type-names) for a general discussion on why to use `auto` to avoid redundant repetition of type names.
This commit is contained in:
practicalswift
2017-05-05 09:38:49 +02:00
parent c6ef8022ae
commit 492f5cd35a
123 changed files with 407 additions and 407 deletions

View File

@@ -952,7 +952,7 @@ static void sortRecursive(const Options &options, Group *group,
auto &contents = group->contents;
double best = -1.0;
for (auto &item : contents) {
if (Group *g = dyn_cast<Group>(item.get())) {
if (auto *g = dyn_cast<Group>(item.get())) {
sortRecursive(options, g, hasExpectedTypes);
} else {
Result *r = cast<Result>(item.get());
@@ -1047,7 +1047,7 @@ void CodeCompletionOrganizer::Impl::groupStemsRecursive(
auto start = worklist.begin();
while (start != worklist.end()) {
if (Group *g = dyn_cast<Group>(start->get())) {
if (auto *g = dyn_cast<Group>(start->get())) {
groupStemsRecursive(g, recurseIntoNewGroups, getStem);
newContents.push_back(std::move(*start));
++start;