Scalafix

Scalafix

  • User guide
  • Developer guide
  • Browse sources
  • GitHub

›Rules

Usage

  • Installation
  • Configuration
  • Suppressing rules

Rules

  • Built-in rules
  • DisableSyntax
  • ExplicitResultTypes
  • LeakingImplicitClassVal
  • NoAutoTupling
  • NoValInForComprehension
  • OrganizeImports
  • ProcedureSyntax
  • RedundantSyntax
  • RemoveUnused
  • Using external rules
  • Community rules

Misc

  • Related projects
Edit

NoValInForComprehension

Removes val from definitions in for-comprehension:

// before
for {
  n <- List(1, 2, 3)
  val inc = n + 1
} yield inc
// after
for {
  n <- List(1, 2, 3)
  inc = n + 1
} yield inc

The two syntaxes are equivalent and the presence of the val keyword has been deprecated since Scala 2.10.

← NoAutoTuplingOrganizeImports →
Scalafix
Docs
Get startedRulesExtend Scalafix
Community
Chat on DiscordDiscuss on Scala Users
More
GitHub
Copyright © 2025 Scala Center