redundant_type_annotation - ApplebaumIan/BitbucketAPI GitHub Wiki

Redundant Type Annotation

Variables should not have redundant type annotation

  • Identifier: redundant_type_annotation
  • Enabled by default: Disabled
  • Supports autocorrection: Yes
  • Kind: idiomatic
  • Analyzer rule: No
  • Minimum Swift compiler version: 3.0.0
  • Default configuration: warning

Non Triggering Examples

var url = URL()
var url: CustomStringConvertible = URL()
@IBInspectable var color: UIColor = UIColor.white

Triggering Examples

var url↓:URL=URL()
var url↓:URL = URL(string: "")
var url↓: URL = URL()
let url↓: URL = URL()
lazy var url↓: URL = URL()
let alphanumerics↓: CharacterSet = CharacterSet.alphanumerics
class ViewController: UIViewController {
  func someMethod() {
    let myVar↓: Int = Int(5)
  }
}