Using const qualifier on the shared_ptr return type is ineffective and unneeded. clang-tidy points out:
warning: return type 'const std::shared_ptr' is 'const'-qualified at the top level, which may reduce code readability without improving const correctness [readability-const-return-type]
std::shared_ptr const
Prerequisites
Description
This is a sort-of bug and really a minor issue.
Using const qualifier on the shared_ptr return type is ineffective and unneeded. clang-tidy points out:
warning: return type 'const std::shared_ptr' is 'const'-qualified at the top level, which may reduce code readability without improving const correctness [readability-const-return-type]
std::shared_ptr const
See https://stackoverflow.com/questions/63972019/understanding-const-at-top-level-which-may-reduce-code-readability-without-i
for more details.
Steps to Reproduce
To reproduce, run clang-tidy 14 or 15 on the code base, or any code that uses a
const std::shared_ptr<http_response>
return type.Expected behavior: [What you expect to happen]
No issues found (at least not this one, there maybe other things that clang-tidy flags).
Actual behavior: [What actually happens]
clang-tidy reports the issue.
Reproduces how often: [What percentage of the time does it reproduce?] 100%
Versions
clang-tidy 14 or 15, possibly earlier versions as well.
Additional Information
None