Skip to content

Commit b022b55

Browse files
committed
Use Using.resource
1 parent 39717f1 commit b022b55

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

compiler/test/dotty/tools/utils.scala

+1-5
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,7 @@ def assertThrows[T <: Throwable: ClassTag](p: T => Boolean)(body: => Any): Unit
4747
end assertThrows
4848

4949
def toolArgsFor(files: List[JPath], charset: Charset = UTF_8): List[String] =
50-
files.flatMap(path => toolArgsParse {
51-
val stream = Files.lines(path, charset)
52-
try stream.limit(10).toScala(List)
53-
finally stream.close()
54-
})
50+
files.flatMap(path => toolArgsParse(resource(Files.lines(path, charset))(_.limit(10).toScala(List))))
5551

5652
// Inspect the first 10 of the given lines for compiler options of the form
5753
// `// scalac: args`, `/* scalac: args`, ` * scalac: args`.

0 commit comments

Comments
 (0)