It is narrated on the authority of Abu Hurairah (RA) that the Messenger of Allah (ﷺ) (may peace and blessings be upon him) observed: Two (things) are found among men which are tantamount to unbelief: slandering one's lineage and lamentation on the dead.
Related hadith on this topic
Explanation & Benefits
Shaykh Maulana Abdul Aziz Alvi
Hadith Commentary: Benefits and Issues:
(1)
In the era of ignorance (Jahiliyyah), people used to take pride in their lineage and ancestry, and would criticize and disparage the lineage and ancestry of others, because in their view, superiority and excellence depended not on piety (taqwa) and righteous deeds, but on lineage. However, according to Islam, honor and nobility are based on piety and religiousness. On the Day of Resurrection, lineage and ancestry will be of no benefit without faith (iman) and deeds. Yet, this mentality still persists among Muslims, which is a disbelieving (kafiranah) act, and it is necessary to avoid it.
(2)
Wailing and lamenting loudly over the deceased is also a hallmark of the era of ignorance (Jahiliyyah). In this, they would try to outdo one another, and women would cooperate with each other in mourning (niyahah). Among Muslims, this custom continues as a relic of the era of ignorance, and it is necessary to refrain from it.
Source: Tuhfat al-Muslim: Commentary on Sahih Muslim, Page: 227