Sayyiduna Ibn Abbas (may Allah be pleased with them both) reports that a man said to the Prophet (peace and blessings be upon him): "I find such thoughts in my heart that I consider it better to become charcoal than to utter them." So the Prophet (peace and blessings be upon him) said: "This is clear faith."
Related hadith on this topic