Messenger of Allah (ﷺ) said, A man said: By Allah, Allah will not forgive So-and-so. At this Allah the Almighty said: Who is he who swears by Me that I will not forgive So-and-so? Verily I have forgiven So-and-so and have nullified your [own good] deeds.
[Muslim]