Skip to content

Commit

Permalink
RedundantBraces: keep braces in func w/ param type
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Nov 10, 2024
1 parent 413ea77 commit c7b290e
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,17 @@ class RedundantBraces(implicit val ftoks: FormatTokens)
(getTreeSingleStat(b) match {
case Some(_: Term.PartialFunction) => false
case Some(_: Term.Block) => true
case Some(s) => okLineSpan(s)
case Some(s) => okLineSpan(s) &&
(s match {
case f: Term.FunctionTerm =>
val params = f.paramClause
params.values match {
case param :: Nil => param.decltpe.isEmpty ||
ftoks.isEnclosedInMatching(params)
case _ => true
}
case _ => true
})
case _ => okIfMultipleStats
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9816,12 +9816,12 @@ object Build {
.settings(
generateScalaDocumentation := Def.inputTaskDyn {
val outputDirOverride =
extraArgs.headOption.fold(identity[GenerationConfig](_)) {
newDir => config: GenerationConfig => config.add(OutputDir(newDir))
}
val justAPI = justAPIArg.fold(identity[GenerationConfig](_)) {
_ => config: GenerationConfig => config.remove[SiteRoot]
}
extraArgs.headOption.fold(identity[GenerationConfig](_))(newDir => {
config: GenerationConfig => config.add(OutputDir(newDir))
})
val justAPI = justAPIArg.fold(identity[GenerationConfig](_))(_ => {
config: GenerationConfig => config.remove[SiteRoot]
})
}.evaluated
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9217,13 +9217,13 @@ object Build {
lazy val scaladoc = project.in(file("scaladoc"))
.settings(generateScalaDocumentation := Def.inputTaskDyn {
val outputDirOverride = extraArgs.headOption
.fold(identity[GenerationConfig](_)) {
newDir => config: GenerationConfig => config.add(OutputDir(newDir))
}
.fold(identity[GenerationConfig](_))(newDir => {
config: GenerationConfig => config.add(OutputDir(newDir))
})
val justAPI = justAPIArg
.fold(identity[GenerationConfig](_)) { _ => config: GenerationConfig =>
.fold(identity[GenerationConfig](_))(_ => { config: GenerationConfig =>
config.remove[SiteRoot]
}
})
}.evaluated)
}
<<< #4133 monads with binpack and no newlines in types
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9612,12 +9612,12 @@ object Build {
settings(
generateScalaDocumentation := Def.inputTaskDyn {
val outputDirOverride =
extraArgs.headOption.fold(identity[GenerationConfig](_)) {
newDir => config: GenerationConfig => config.add(OutputDir(newDir))
}
val justAPI = justAPIArg.fold(identity[GenerationConfig](_)) {
_ => config: GenerationConfig => config.remove[SiteRoot]
}
extraArgs.headOption.fold(identity[GenerationConfig](_))(newDir => {
config: GenerationConfig => config.add(OutputDir(newDir))
})
val justAPI = justAPIArg.fold(identity[GenerationConfig](_))(_ => {
config: GenerationConfig => config.remove[SiteRoot]
})
}.evaluated
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9917,15 +9917,15 @@ object Build {
val outputDirOverride =
extraArgs
.headOption
.fold(identity[GenerationConfig](_)) {
newDir => config: GenerationConfig =>
.fold(identity[GenerationConfig](_))(newDir => {
config: GenerationConfig =>
config.add(OutputDir(newDir))
}
})
val justAPI =
justAPIArg.fold(identity[GenerationConfig](_)) {
_ => config: GenerationConfig =>
justAPIArg.fold(identity[GenerationConfig](_))(_ => {
config: GenerationConfig =>
config.remove[SiteRoot]
}
})
}
.evaluated
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class FormatTests extends FunSuite with CanRunTests with FormatAssertions {
val explored = Debug.explored.get()
logger.debug(s"Total explored: $explored")
if (!onlyUnit && !onlyManual)
assertEquals(explored, 1114736, "total explored")
assertEquals(explored, 1114537, "total explored")
val results = debugResults.result()
// TODO(olafur) don't block printing out test results.
// I don't want to deal with scalaz's Tasks :'(
Expand Down

0 comments on commit c7b290e

Please sign in to comment.