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

Fix obvious and straightforward warnings #4323

Merged
merged 7 commits into from
Oct 27, 2022

Conversation

satorg
Copy link
Contributor

@satorg satorg commented Oct 18, 2022

Although it was decided to postpone Cats codebase cleanup for a while until the Scalac options set gets settled completely, some compiler warnings are so obvious and easy-to-fix that I couldn't refrain from fixing them up. Apparently, it is not a complete solution but rather some small relief.

Can be considered as a prelude for #4187 series.

UPD. Turned out, there are also quite a bit of small code optimizations included.

@satorg satorg self-assigned this Oct 18, 2022
@armanbilge armanbilge added the behind-the-scenes appreciated, but not user-facing label Oct 18, 2022
@armanbilge armanbilge added this to the 2.9.0 milestone Oct 18, 2022
Copy link
Member

@armanbilge armanbilge left a comment

Choose a reason for hiding this comment

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

Thanks for chipping away at this! Just a couple questions but LGTM.

core/src/main/scala/cats/data/EitherT.scala Outdated Show resolved Hide resolved
core/src/main/scala/cats/data/EitherT.scala Outdated Show resolved Hide resolved
core/src/main/scala/cats/instances/sortedMap.scala Outdated Show resolved Hide resolved
core/src/main/scala/cats/data/EitherT.scala Outdated Show resolved Hide resolved
core/src/main/scala/cats/data/Func.scala Outdated Show resolved Hide resolved
core/src/main/scala/cats/data/IndexedStateT.scala Outdated Show resolved Hide resolved
core/src/main/scala/cats/instances/map.scala Outdated Show resolved Hide resolved
Copy link
Contributor

@johnynek johnynek left a comment

Choose a reason for hiding this comment

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

A couple of more comments.

core/src/main/scala/cats/data/EitherT.scala Outdated Show resolved Hide resolved
core/src/main/scala/cats/data/Ior.scala Outdated Show resolved Hide resolved
case (Ior.Left(a), Ior.Left(aa)) => AA.eqv(a, aa)
case (Ior.Right(b), Ior.Right(bb)) => BB.eqv(b, bb)
case (Ior.Both(a, b), Ior.Both(aa, bb)) => AA.eqv(a, aa) && BB.eqv(b, bb)
case _ => false
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we are going to discourage using case _ then should I change it to case (_, _) => or something?

Copy link
Member

@danicheg danicheg Oct 20, 2022

Choose a reason for hiding this comment

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

uh oh, here we have 3! cases to match. probably a wildcard case is a trade-off here. (_, _) is fine with me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the wildcard should be fine here – since we construct the tuple in-place then it won't cause any additional value uncertainty like null values or something...

@johnynek johnynek merged commit d936d43 into typelevel:main Oct 27, 2022
@satorg satorg deleted the fix-simple-warnings branch October 27, 2022 04:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
behind-the-scenes appreciated, but not user-facing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants