etr / libhttpserver

C++ library for creating an embedded Rest HTTP server (and more)
GNU Lesser General Public License v2.1
884 stars 185 forks source link

[BUG] use of const shared_ptr return type is ineffective/unneeded #284

Closed stuart-byma closed 1 year ago

stuart-byma commented 1 year ago

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

etr commented 1 year ago

It does make sense - I just approved the PR. Thanks a lot for your help.