Fix clang-tidy readability-const-return-type violations
Summary:
This comes up during review, so instead of wasting review cycles on this, just enforce it via CI
From the clang-tidy doc:
Such use of const is usually superfluous, and can prevent valuable compiler optimizations. Does not (yet) fix trailing return types.
I have never seen it mentioned in our reviews, but my IDE flags these issues, and it can maybe save us some merge conflicts during backports.
This is a backport of core#26395
Depends on D18073
Test Plan:
cmake .. -GNinja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DENABLE_CLANG_TIDY=ON ninja all check-all
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Differential Revision: https://reviews.bitcoinabc.org/D18074