Uploaded image for project: 'SonarSwift'
  1. SonarSwift
  2. SONARSWIFT-104

Underscore sign should not be defined as unused local variable

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.2
    • Component/s: Rules
    • Labels:
      None

      Description

      func foo(){
         let (_, x) = bar();  // will raise an issue for "_" but it should not
         print(x);
      }
      

      If you only need some of the tuple’s values, ignore parts of the tuple with an underscore (_) when you decompose the tuple:

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              elena.vilchik Elena Vilchik
              Reporter:
              elena.vilchik Elena Vilchik
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: