-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Labels
bugUnexpected and reproducible misbehavior.Unexpected and reproducible misbehavior.
Description
New Issue Checklist
- I've Updated SwiftLint to the latest version.
- I've searched for existing GitHub issues.
Bug Description
(fairly) minimal example I created:
import Foundation
public class Uploader {
public func start(completion: @escaping (Result<String, Error>) -> Void) {
DispatchQueue.global(qos: .userInitiated).async {
let result: [Result<String, Error>] = [1].map { _ in .success("Success") }
completion(result.first!)
}
}
}Running:
swiftlint lint --only-rule unneeded_escaping --no-cache ./a.swiftResults in:
a.swift:5:35: warning: Unneeded Escaping Violation: @escaping attribute not required as 'completion' does not escape (unneeded_escaping)
but it cannot be removed:
swift ./a.swift
a.swift:6:57: error: escaping closure captures non-escaping parameter 'completion'It somehow has todo with the map, because if I change the code to let result = Result.success("Success"), no error is reported anymore
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugUnexpected and reproducible misbehavior.Unexpected and reproducible misbehavior.