Skip to content

Files

Latest commit

 

History

History
38 lines (19 loc) · 586 Bytes

redundant_discardable_let.md

File metadata and controls

38 lines (19 loc) · 586 Bytes

Pattern: Redundant discardable let

Issue: -

Description

Prefer _ = foo() over let _ = foo() when discarding a result from a function.

Examples of correct code:

_ = foo()


if let _ = foo() { }


guard let _ = foo() else { return }


let _: ExplicitType = foo()


while let _ = SplashStyle(rawValue: maxValue) { maxValue += 1 }

Examples of incorrect code:

let _ = foo()


if _ = foo() { let _ = bar() }

Further Reading