From Sahih Muslim (Hadith 332):
It is narrated on the authority of Abu Huraira that the Messenger of Allah (ﷺ) observed:Verily the Great and Mighty Allah forgave my people the evil promptings arising in their minds, but they neither talked about them nor acted upon them
Reference: Muslim 332