diff --git a/os/src/Using.scala b/os/src/Using.scala index eeafb868..4927a9ad 100644 --- a/os/src/Using.scala +++ b/os/src/Using.scala @@ -95,7 +95,8 @@ import scala.util.control.{ControlThrowable, NonFatal} * - `java.lang.VirtualMachineError` * - `java.lang.LinkageError` * - `java.lang.InterruptedException` and `java.lang.ThreadDeath` - * - [[scala.util.control.NonFatal fatal exceptions]], excluding `scala.util.control.ControlThrowable` + * - [[scala.util.control.NonFatal fatal exceptions]], excluding + * `scala.util.control.ControlThrowable` * - `scala.util.control.ControlThrowable` * - all other exceptions * @@ -115,7 +116,8 @@ object Using { * @return a [[Try]] containing an exception if one or more were thrown, * or the result of the operation if no exceptions were thrown */ - def apply[R: Releasable, A](resource: => R)(f: R => A): Try[A] = Try { Using.resource(resource)(f) } + def apply[R: Releasable, A](resource: => R)(f: R => A): Try[A] = + Try { Using.resource(resource)(f) } /** A resource manager. * @@ -236,10 +238,13 @@ object Using { case _: LinkageError => 3 case _: InterruptedException | _: ThreadDeath => 2 case _: ControlThrowable => 0 - case e if !NonFatal(e) => 1 // in case this method gets out of sync with NonFatal + case e if !NonFatal(e) => + 1 // in case this method gets out of sync with NonFatal case _ => -1 } - @inline def suppress(t: Throwable, suppressed: Throwable): Throwable = { t.addSuppressed(suppressed); t } + @inline def suppress(t: Throwable, suppressed: Throwable): Throwable = { + t.addSuppressed(suppressed); t + } if (score(secondary) > score(primary)) suppress(secondary, primary) else suppress(primary, secondary) diff --git a/os/test/src/TempPathTests.scala b/os/test/src/TempPathTests.scala index cbcad556..55729f01 100644 --- a/os/test/src/TempPathTests.scala +++ b/os/test/src/TempPathTests.scala @@ -15,7 +15,8 @@ object TempPathTests extends TestSuite{ tempFilePath = file.toString assert(os.exists(file)) } - assert(!os.exists(os.Path(tempFilePath)), s"temp file did not get auto-deleted after `Using` block: $tempFilePath") + assert(!os.exists(os.Path(tempFilePath)), + s"temp file did not get auto-deleted after `Using` block: $tempFilePath") } test("temp.withDir") { var tempDirPath: String = null @@ -28,7 +29,8 @@ object TempPathTests extends TestSuite{ assert(os.exists(dir)) assert(os.exists(file)) } - assert(!os.exists(os.Path(tempDirPath)), s"temp dir did not get auto-deleted after `Using` block: $tempDirPath") + assert(!os.exists(os.Path(tempDirPath)), + s"temp dir did not get auto-deleted after `Using` block: $tempDirPath") } } @@ -39,7 +41,8 @@ object TempPathTests extends TestSuite{ tempFilePath = file.toString assert(os.exists(file)) } - assert(!os.exists(os.Path(tempFilePath)), s"temp file did not get auto-deleted after `Using` block: $tempFilePath") + assert(!os.exists(os.Path(tempFilePath)), + s"temp file did not get auto-deleted after `Using` block: $tempFilePath") } test("directory") { var tempDirPath: String = null @@ -52,7 +55,8 @@ object TempPathTests extends TestSuite{ assert(os.exists(dir)) assert(os.exists(file)) } - assert(!os.exists(os.Path(tempDirPath)), s"temp dir did not get auto-deleted after `Using` block: $tempDirPath") + assert(!os.exists(os.Path(tempDirPath)), + s"temp dir did not get auto-deleted after `Using` block: $tempDirPath") } test("multiple files") { @@ -65,7 +69,8 @@ object TempPathTests extends TestSuite{ files.foreach(file => assert(os.exists(file))) } tempFilePaths.foreach { file => - assert(!os.exists(os.Path(file)), s"temp file did not get auto-deleted after `Using` block: $file") + assert(!os.exists(os.Path(file)), + s"temp file did not get auto-deleted after `Using` block: $file") } } }