Skip to content

Fix obvious and straightforward warnings#4323

Merged
johnynek merged 7 commits into
typelevel:mainfrom
satorg:fix-simple-warnings
Oct 27, 2022
Merged

Fix obvious and straightforward warnings#4323
johnynek merged 7 commits into
typelevel:mainfrom
satorg:fix-simple-warnings

Conversation

@satorg

@satorg satorg commented Oct 18, 2022

Copy link
Copy Markdown
Contributor

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 force-pushed the fix-simple-warnings branch from bf5a1d6 to 369860c Compare October 18, 2022 07:12
@satorg satorg self-assigned this Oct 18, 2022
Comment thread core/src/main/scala/cats/data/EitherT.scala Outdated
@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

@armanbilge armanbilge left a comment

Copy link
Copy Markdown
Member

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.

Comment thread core/src/main/scala/cats/data/EitherT.scala Outdated
Comment thread core/src/main/scala/cats/data/EitherT.scala Outdated
Comment thread core/src/main/scala/cats/instances/sortedMap.scala Outdated
Comment thread core/src/main/scala/cats/data/EitherT.scala Outdated
Comment thread core/src/main/scala/cats/data/Func.scala Outdated
Comment thread core/src/main/scala/cats/data/IndexedStateT.scala Outdated
Comment thread core/src/main/scala/cats/instances/map.scala Outdated
@satorg
satorg force-pushed the fix-simple-warnings branch from 369860c to dfd2d70 Compare October 19, 2022 07:16

@johnynek johnynek left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread core/src/main/scala/cats/data/EitherT.scala Outdated
Comment thread core/src/main/scala/cats/data/Ior.scala Outdated
@satorg
satorg force-pushed the fix-simple-warnings branch from dfd2d70 to 8ffbef1 Compare October 19, 2022 07:54
Comment thread core/src/main/scala/cats/data/Validated.scala Outdated
Comment thread core/src/main/scala/cats/data/EitherT.scala Outdated
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
Copy Markdown
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?

@danicheg danicheg Oct 20, 2022

Copy link
Copy Markdown
Member

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
Copy Markdown
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