In his famous collection of 40(actually 42) comprehensive ahaadeeth, Imam al-Nawawi brings the following two connected hadeeth in the same section:
عَنْ النَّوَّاسِ بْنِ سَمْعَانَ رَضِيَ اللهُ عَنْهُ عَنْ النَّبِيِّ صلى الله عليه و سلم قَالَ: “الْبِرُّ حُسْنُ الْخُلُقِ، وَالْإِثْمُ مَا حَاكَ فِي صَدْرِك، وَكَرِهْت أَنْ يَطَّلِعَ عَلَيْهِ النَّاسُ” رَوَاهُ مُسْلِمٌ . رَوَاهُ مُسْلِمٌ
On the authority of an-Nawwaas bin Sam’aan (may Allah be pleased with him), that the Prophet (ﷺ) said, “Righteousness is in good character, and ithm (wrongdoing) is that which wavers in your soul, and which you dislike people finding out about.” [Muslim]وَعَنْ وَابِصَةَ بْنِ مَعْبَدٍ رَضِيَ اللهُ عَنْهُ قَالَ: أَتَيْت رَسُولَ اللَّهِ صلى الله عليه و سلم فَقَالَ: “جِئْتَ تَسْأَلُ عَنْ الْبِرِّ؟ قُلْت: نَعَمْ. فقَالَ: استفت قلبك، الْبِرُّ مَا اطْمَأَنَّتْ إلَيْهِ النَّفْسُ، وَاطْمَأَنَّ إلَيْهِ الْقَلْبُ، وَالْإِثْمُ مَا حَاكَ فِي النَّفْسِ وَتَرَدَّدَ فِي الصَّدْرِ، وَإِنْ أَفْتَاك النَّاسُ وَأَفْتَوْك” .حَدِيثٌ حَسَنٌ، رَوَيْنَاهُ في مُسْنَدَي الْإِمَامَيْنِ أَحْمَدَ بْنِ حَنْبَلٍ ، وَالدَّارِمِيّ بِإِسْنَادٍ حَسَنٍ.
And on the authority of Waabisah bin Ma’bad (may Allah be pleased with him) who said: I came to the Messenger of Allah (ﷺ) and he said, “You have come to ask about righteousness.” I said, “Yes.” He (peace and blessings of Allah be upon him) said, “Consult your heart. Righteousness is that about which the soul feels at ease and the heart feels tranquil. And ithm is that which wavers in the soul and causes uneasiness in the breast, even though people have repeatedly given their legal opinion.”A good hadeeth transmitted from the musnads of the two imams, Ahmed bin Hanbal and Al- Daarimi, with a good chain of authorities.
[al-Arba'een #27]