Remove redundant identifier in optional binding if condition

This product is not supported for your selected Datadog site. ().
このページは日本語には対応しておりません。随時翻訳に取り組んでいます。
翻訳に関してご質問やご意見ございましたら、お気軽にご連絡ください

Metadata

ID: swift-code-style/if-let-shorthand

Language: Unknown

Severity: Warning

Category: Code Style

Description

Non-Compliant Code Examples

if let name = name {
    // ...
}

if let self = self {
    // ...
}
    
if interactionEnabled,
   let userTapLocation = userTapLocation {
    // ...
}

if let user = user, 
   var device = device {
    // ...
}

Compliant Code Examples

if let name {
    // ...
}

if let name = user?.name {
    // ...
}
    
if let user = user as? User {
    // ...
}
 
if var user = currentUser() {
    // ...
}
https://static.datadoghq.com/static/images/logos/github_avatar.svg https://static.datadoghq.com/static/images/logos/vscode_avatar.svg jetbrains

シームレスな統合。 Datadog Code Security をお試しください