Your ability to successfully fund your retirement and to finance your other financial objectives is dependent on your net worth, i.e. your assets less your liabilities. So whenever you have excess cash flow, whether as a result of a one-time windfall like an inheritance or simply by virtue of your income exceeding your expenses on an ongoing basis, a conscious decision should be made whether to invest/save on the one hand or to reduce debt on the other. Unfortunately the decision to invest/save vs. to repay debt is one of the many financial planning questions to which you'll only know the right answer with hindsight, but here is a framework in which to consider this question.
From a financial planning perspective, what to do with excess cash flow boils down to a comparison between the interest rates associated with your debts and the returns that would be generated by investing or saving these funds instead. In other words, you should consider paying off any debts having related interest rates higher than the returns that would otherwise be expected to be received from investing or saving those repayment funds. (Outstanding credit card balances often fall into this category.)
So the first question that should be asked is "If I didn't pay off that debt, what would I do with those funds?" If the answer to that question is that the funds would be invested in a diversified portfolio, then the next step would be to compare the expected returns of that portfolio with the interest rate of the debt in question. If the former exceeds the latter, then the debt should remain outstanding. On the other hand, it also follows that if the repayment funds will instead be spent or stuck in a bank account earning less than 2%, then paying down the debt is more prudent.
Of course the difficulty with the "repay debt vs. invest in a diversified portfolio" decision is that you probably won't know in advance the future return on this portfolio with any degree of certainty. The mistake I think many are currently making is to assume that the stock market returns that we have experienced since the Great Recession are indicative of what to expect going forward. This assumption is leading many to invest when they should be taking advantage of the "guaranteed return" of debt repayment.
As usual, tax considerations also muddy the waters surrounding this financial decision. Some debt, such as mortgage debt and student loans, may have tax benefits associated with them which tend to tip the balance towards leaving them outstanding. On the investing side of the weighing scale, expected returns should be tempered by the potential "tax drag" of investing within a taxable account or augmented by the tax benefits of possibly being able to combine investing with tax-deductible IRA or retirement plan contributions.
And even this discussion doesn't cover all of the considerations related to debt repayment. To read an article on the topic by Catey Hill in SmartMoney magazine to which I contributed some years ago, please click on "Choosing the Debts to Pay Off Now (And Later)".