Skip to content

unneeded_throws_rethrows shows false positives for protocol conformances #6437

@username0x0a

Description

@username0x0a

New Issue Checklist

Bug Description

When opting in to a unneeded_throws_rethrows, I'm getting false positives for the following case:

protocol Throwing {
    func doSomething() throws
}

struct SomeType: Throwing {

                        vvvv
    func doSomething() throws {
                        ^^^^
        // Closure without anything thrown
        print("Hello")
    }
}

I believe that this case where the throws declaration is enforced by the protocol conformance shouldn't trigger a positive report for this rule.

Environment

  • SwiftLint 0.63.0
  • Xcode 26.2 (17C52)
  • Installed via Homebrew
...
opt_in_rules:
- unneeded_throws_rethrows
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    repro-neededIssues that cannot be reproduced or miss proper descriptive examples.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions