I heard Allah's Apostle ﷺ as saying three days before his death: None of you should court death but only hoping good from Allah (Using translation from Muslim 2877a)
سَمِعْتُ النَّبِيَّ ﷺ قَبْلَ مَوْتِهِ بِثَلَاثٍ يَقُولُ لَا يَمُوتَنَّ أَحَدُكُمْ إِلَّا وَهُوَ يُحْسِنُ بِاللهِ الظَّنَّ