Sahih al-Bukhari, Book 81, Hadith 101 (In-Book)

Narrated Abu Qatada bin Rib'i Al-Ansari: A funeral procession passed by Allah's Messenger who said, "Relieved or relieving?" The people asked, "O Allah's Messenger! What is relieved and relieving?" He said, "A believer is relieved (by death) from the troubles and hardships of the world and leaves for the Mercy of Allah, while (the death of) a wicked person relieves the people, the land, the trees, (and) the animals from him."

حَدَّثَنَا إِسْمَاعِيلُ، قَالَ حَدَّثَنِي مَالِكٌ، عَنْ مُحَمَّدِ بْنِ عَمْرِو بْنِ حَلْحَلَةَ، عَنْ مَعْبَدِ بْنِ كَعْبِ بْنِ مَالِكٍ، عَنْ أَبِي قَتَادَةَ بْنِ رِبْعِيٍّ الأَنْصَارِيِّ، أَنَّهُ كَانَ يُحَدِّثُ أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم مُرَّ عَلَيْهِ بِجِنَازَةٍ فَقَالَ ‏"‏ مُسْتَرِيحٌ، وَمُسْتَرَاحٌ مِنْهُ ‏"‏‏.‏ قَالُوا يَا رَسُولَ اللَّهِ مَا الْمُسْتَرِيحُ وَالْمُسْتَرَاحُ مِنْهُ قَالَ ‏"‏ الْعَبْدُ الْمُؤْمِنُ يَسْتَرِيحُ مِنْ نَصَبِ الدُّنْيَا وَأَذَاهَا إِلَى رَحْمَةِ اللَّهِ، وَالْعَبْدُ الْفَاجِرُ يَسْتَرِيحُ مِنْهُ الْعِبَادُ وَالْبِلاَدُ وَالشَّجَرُ وَالدَّوَابُّ ‏"‏‏.‏

sunnah.com