That's an excellent and very practical question! It really depends on the specific city and the type of trash can installed. In many modern cities, especially those investing in "smart city" infrastructure, you will increasingly find public trash bins with lids that close automatically. These are often spring-loaded or weighted so that after you release the lid, it slowly swings shut on its own. The primary purpose is absolutely to keep rain and snow out. This helps prevent the bins from filling with water, which makes the waste much heavier, smells worse, and can create stagnant water that breeds pests like mosquitoes.
However, in plenty of older or more traditional setups, you'll still see simple open-top bins or ones with lids that must be manually closed. These are cheaper to manufacture and install. The trade-off is that they are less effective at containing odors and can become soggy messes during a downpour, leading to overflow and litter problems.
So, to answer directly: Yes, many contemporary urban trash cans are designed with self-closing lids specifically as a feature to mitigate rain issues, improve public sanitation, and reduce maintenance costs. But it's not a universal standard yet. The move toward automatic lids is a clear trend in urban planning aimed at creating cleaner, more efficient, and more hygienic public spaces.