swiftlang/swift

[SR-5742] Refactoring action to convert imperative code to functional style

开放

#48,312 创建于 2017年8月23日

 (1 条评论) (0 个反应) (0 位负责人)Swift (10,719 个派生)batch import
IDE supportcompilerfeaturegood first issuerefactoring

仓库指标

星标
 (69,989 个星标)
PR 合并指标
 (平均合并 8天 17小时) (30 天内合并 510 个 PR)

描述

Previous ID SR-5742
Radar rdar://32751280
Original Reporter @akyrtzi
Type New Feature
Votes 1
Component/s Source Tooling
Labels New Feature, Refactoring, StarterProposal
Assignee kacperh (JIRA)
Priority Medium

md5: d8dd54b6f1cfe6d2981c48e99ab5db6d

Issue Description:

Implement action to change code such as this:

func foo(list : [String]) {
  var result = [String]()

  for element in list {
    if !element.isEmpty {
      result.append(element)
    }
  }
}

to

func foo(list : [String]) {
  var result = list.filter { !$0.isEmpty }
}

贡献者指南