Skip to content

unneeded_escaping false positive in 0.63.0 #6410

Closed

Description

@Nef10

New Issue Checklist

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.swift

Results 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

Activity

  1. added
    bug
    on Jan 5, 2026
  2. self-assigned this
    on Jan 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions