If they had a good faith basis to believe you had committed a crime (and not merely a traffic violation), they would have had the right to arrest you and search your pockets. If not, then they should not have done so. Usually, the "punishment" for an illegal search by police is the exclusion of illegally-found evidence from the prosecution against the accused. But in this case you were not charged, so the issue is moot.
Answered on Jan 21st, 2016 at 5:38 PM