Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:31:23

And whoever has disbelieved - let not his disbelief grieve you. To Us is their return, and We will inform them of what they did. Indeed, Allah is Knowing of that within the breasts.  

And whoever disbelieves, then do not let his disbelief grieve you, O Muhammad (s), do not be concerned with his disbelief. To Us shall be their return and We shall inform them of what they did. Truly God knows ˹best˺ what is in the breasts, just as ˹He knows˺ other things, and so He will requite ˹them˺ accordingly.
القرآن:٣١:٢٣

وَمَنْ كَفَرَ فَلَا يَحْزُنْكَ كُفْرُهُ ۚ إِلَيْنَا مَرْجِعُهُمْ فَنُنَبِّئُهُمْ بِمَا عَمِلُوا ۚ إِنَّ اللَّهَ عَلِيمٌ بِذَاتِ الصُّدُورِ  

{ومن كفر فلا يَحزُنْك} يا محمد {كفره} لا تهتم بكفره {إلينا مرجعهم فننبئهم بما عملوا إن الله عليم بذات الصدور} أي بما فيها كغيره فمجاز عليه.