Skip to content

Commit 3bd0044

Browse files
committed
[Gardening] Remove remaining casting artifacts
1 parent 66f2733 commit 3bd0044

File tree

6 files changed

+7
-7
lines changed

6 files changed

+7
-7
lines changed

lib/AST/ASTDumper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,7 @@ namespace {
716716

717717
if (auto *var = dyn_cast<VarDecl>(VD)) {
718718
PrintWithColorRAII(OS, TypeColor) << " type='";
719-
if (auto varTy = var->hasInterfaceType())
719+
if (var->hasInterfaceType())
720720
var->getType().print(PrintWithColorRAII(OS, TypeColor).getOS());
721721
else
722722
PrintWithColorRAII(OS, TypeColor) << "<null type>";

lib/AST/AccessRequests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ DefaultAndMaxAccessLevelRequest::evaluate(Evaluator &evaluator,
213213

214214
AccessLevel maxAccess = AccessLevel::Public;
215215

216-
if (GenericParamList *genericParams = ED->getGenericParams()) {
216+
if (ED->getGenericParams()) {
217217
// Only check the trailing 'where' requirements. Other requirements come
218218
// from the extended type and have already been checked.
219219
DirectlyReferencedTypeDecls typeDecls =

lib/AST/Module.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1218,7 +1218,7 @@ ModuleDecl::ReverseFullNameIterator::operator++() {
12181218
if (!current)
12191219
return *this;
12201220

1221-
if (auto *swiftModule = current.dyn_cast<const ModuleDecl *>()) {
1221+
if (current.is<const ModuleDecl *>()) {
12221222
current = nullptr;
12231223
return *this;
12241224
}

lib/AST/Type.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2023,7 +2023,7 @@ getObjCObjectRepresentable(Type type, const DeclContext *dc) {
20232023
// DynamicSelfType is always representable in Objective-C, even if
20242024
// the class is not @objc, allowing Self-returning methods to witness
20252025
// @objc protocol requirements.
2026-
if (auto dynSelf = type->getAs<DynamicSelfType>())
2026+
if (type->is<DynamicSelfType>())
20272027
return ForeignRepresentableKind::Object;
20282028

20292029
// @objc classes.
@@ -4098,7 +4098,7 @@ case TypeKind::Id:
40984098
auto fnTy = cast<SILFunctionType>(base);
40994099
bool changed = false;
41004100

4101-
if (auto subs = fnTy->getSubstitutions()) {
4101+
if (fnTy->getSubstitutions()) {
41024102
#ifndef NDEBUG
41034103
// This interface isn't suitable for updating the substitution map in a
41044104
// substituted SILFunctionType.

lib/AST/TypeCheckRequests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ SourceLoc WhereClauseOwner::getLoc() const {
363363

364364
void swift::simple_display(llvm::raw_ostream &out,
365365
const WhereClauseOwner &owner) {
366-
if (auto where = owner.source.dyn_cast<TrailingWhereClause *>()) {
366+
if (owner.source.is<TrailingWhereClause *>()) {
367367
simple_display(out, owner.dc->getAsDecl());
368368
} else if (owner.source.is<SpecializeAttr *>()) {
369369
out << "@_specialize";

lib/IRGen/IRGenMangler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ IRGenMangler::withSymbolicReferences(IRGenModule &IGM,
120120
}
121121

122122
return true;
123-
} else if (auto opaque = s.dyn_cast<const OpaqueTypeDecl *>()) {
123+
} else if (s.is<const OpaqueTypeDecl *>()) {
124124
// Always symbolically reference opaque types.
125125
return true;
126126
} else {

0 commit comments

Comments
 (0)