Skip to content
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

Clean up - removed 27 warnings #1817

Merged
merged 11 commits into from
May 20, 2019
Merged

Conversation

carloscaldas
Copy link
Collaborator

@carloscaldas carloscaldas commented May 17, 2019

This change is Reviewable

@carloscaldas carloscaldas self-assigned this May 18, 2019
@carloscaldas carloscaldas requested a review from REASY May 18, 2019 19:29
@@ -249,7 +249,7 @@ class RideHailModifyPassengerScheduleManager(

def startWaveOfRepositioningOrBatchedReservationRequests(tick: Int, triggerId: Long): Unit = {
assert(
vehicleIdToModifyPassengerScheduleStatus.toVector.unzip._2.count(x => x.nonEmpty)
vehicleIdToModifyPassengerScheduleStatus.toVector.map(_._2).count(x => x.nonEmpty)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just do count(x => x._2.nonEmpty)?

.filter(_.isDefined)
.headOption
.getOrElse(None)
.find(_.isDefined)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be cleaned even further:

.collectFirst{ case Some(x) => x }

Copy link
Collaborator Author

@carloscaldas carloscaldas May 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

collectFirst will extract using destructor and then instantiate again a new Option/Some (it was already option previously). Syntax is a little bit better, but not sure it is worthy for this specific case. Applied suggestion anyway

@carloscaldas
Copy link
Collaborator Author

test!

1 similar comment
@JustinPihony
Copy link
Collaborator

test!

@carloscaldas carloscaldas merged commit 36f2243 into develop May 20, 2019
@carloscaldas carloscaldas deleted the ccaldas/cleanup-2019-05-4ci branch May 20, 2019 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants