You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Though I suppose there may be legitimate use cases for a unit _by_key for some methods, so it might be a good idea to restrict it to just some types / be a bit smarter and let people explicitly return unit.
pmnoxx
changed the title
Likely a bug, when using sort_by_key with void lambda.
New link: redundant_sort_by_key.
Jan 7, 2022
pmnoxx
changed the title
New link: redundant_sort_by_key.
New lint: redundant_sort_by_key.
Jan 7, 2022
What it does
I saw an interesting bug today. Apparently the following code is valid.
The extra semicolon makes this function return
()
, which is valid, but this makes the sorting pointless.Lint Name
useless_sort_by_key
Category
correctness
Advantage
Drawbacks
Example
Could be written as:
That codes does nothing can be removed.
Or can be fixed, but it may be impossible to figure out what the user intended
I think this should be marked as an potential error.
The text was updated successfully, but these errors were encountered: