swiftlang/swift

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

オープン

#48,312 opened on 2017/08/23

 (1 件のコメント) (0 件のリアクション) (0 人の担当者)Swift (10,719 件のフォーク)batch import
IDE supportcompilerfeaturegood first issuerefactoring

Repository metrics

Stars
 (69,989 個のスター)
PR merge metrics
 (平均マージ 8d 17h) (30d で 510 merged PRs)

説明

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 }
}

コントリビューターガイド