More transparency in a society is for the better. This shouldn't stop at salaries. Why aren't service providers required to disclose what they charge others? Why aren't dentists, lawyers, surgeons etc... required to report their stats? All of those would break information asymmetry and make for better decisions all around and less scams.
your bank already knows your salary, and if they don't they are going to ask for it as a condition to give you credit. in some countries landlords ask for proof of income too. the less regulated these areas, the more likely that is going to happen.
Even better, grocery stores might make various discounts and promotions eligible based on whether you belong to a certain bottom percentile of income. That’s the holy grail of price discrimination („milk them for all they have”), which is now attempted to achieve only through imperfect means such as premium brands, up-sells etc.