All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
It may be that you are referring to the Hadeeth reported by Muslim in his Saheeh that the Prophet said: “The sin is that which creates doubt and you do not like people to know about it.”
Moreover, Waasibah ibn Ma’bad narrated: “I came to the Prophet and he asked me: “Have you come to inquire about piety?” I replied in the affirmative. Then he said, “Ask your heart regarding it. Piety is that which contents the soul and comforts the heart, and sin is that which causes doubts and perturbs the heart, even if people pronounce it lawful and give you verdicts on such matters again and again [that they are lawful].” [Ahmad]
What is meant by these Ahadeeth and others that have similar meanings is that:
If the sound believer who has a pure heart is hesitant and has doubt in his heart about the lawfulness of something, then he should avoid it and leave it. This is a sign that it is a sin.
However, if a clear Islamic evidence indicates that that matter is lawful, then there is no consideration of the worry of the layman and his having doubt in his heart, as there is no doubt about the lawfulness of a matter about which there is evidence in the texts of the Sharee’ah that it is lawful; especially the one who suffers from whispers, as he is ill and not sound in principle.
Among the rules determined by the scholars is that a person who suffers from whispers does not have to take precautions as a way of taking into account the privacy of his illness because precautions open for him doors of endless evils, which spoil both his religion and his worldly matters.
Allah knows best.