-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minor syntax improvements #514
Conversation
643c5db
to
23d4f96
Compare
@@ -78,7 +78,13 @@ class ErrorCollector extends ErrorContext { | |||
.foreach { | |||
case (page, errors) => | |||
// Load contents of the page | |||
val lines = scala.io.Source.fromFile(page)("UTF-8").getLines().toList |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Intellij handily picked up the fact that the handle from source
is never actually closed which actually causes a leak hence the change here. There are nicer ways of doing this i.e. using Using
but this is only available in Scala 2.13
b1863a9
to
0371bc6
Compare
0371bc6
to
07539a5
Compare
So the latest test run is failing on Maybe rerunning the tests should work? (although not sure why such a test would be flaky) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, nice little cleanup, thanks!
Oh, I missed the test failure, which is ofc not LGTM :) |
@johanandren Can you rerun the tests? The tests passed in a previous run and locally, I actually cannot replicate this error (or something really weird is going on) |
Not sure what happened with the tests, rerun is fine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏼 nice cleanup
This PR applies syntax improvements that are the result of Intellij's default code inspections.
Some additional notes
Unit
type annotation was added to any method that happened to returnUnit
(i.e. side effecting methods that don't return anything)..toSeq
conversions were removed since Intellij marked them as pointless (being the same type). I am quite sure this is not going to cause issues but I would double check here just to make sure nothing odd happens@tailrec
annotation doesn't actually change anything in the resulting generated bytecode but it will actually confirm that scalac will correctly translation the recursion into an efficient while loop..close()
wasn't being called, or it was but the expression wasn't in atry
/finally
block which would mean if there is an exception (for some reason) then the handle's wouldn't be released. I have fixed these cases.