Skip to content

False positive in UnnecessaryLet #2987

@BraisGabin

Description

@BraisGabin

Expected Behavior

UnnecessaryLet takes in account if the we use the return value of let or not.

Observed Behavior

UnnecessaryLet flags some of those.

Steps to Reproduce

val a = listOf<List<String>?>(listOf(""))
    .map { list -> list?.let { it + it } }

Context

This is the same problem that #2938 but with UnnecessaryLet instead of UnnecessaryApply

Your Environment

  • Version of detekt used: 1.11.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions