tidy: enable readability-redundant-string-init #25705

pull fanquake wants to merge 2 commits into bitcoin:master from fanquake:redundant_string_inits changing 6 files +7 −5
  1. fanquake commented at 9:27 AM on July 26, 2022: member

    Remove unnecessary std::string = "" initializations. Enable readability-redundant-string-init.

    See: https://releases.llvm.org/14.0.0/tools/clang/tools/extra/docs/clang-tidy/checks/readability-redundant-string-init.html

  2. refactor: remove unnecessary string initializations 4ddd746bf9
  3. tidy: enable readability-redundant-string-init
    See:
    https://releases.llvm.org/14.0.0/tools/clang/tools/extra/docs/clang-tidy/checks/readability-redundant-string-init.html
    49168df073
  4. shaavan approved
  5. shaavan commented at 1:22 PM on July 26, 2022: contributor

    ACK 49168df073d465450b1da4a506ac7ea24fbbb87

    • I agree with adding the redundant string init clang-tidy check, as this makes the code cleaner and free of redundancies.
    • Verified that the clang-tidy check works perfectly, and Commit-1 covers all the instances of the check by:
    1. Resetting the branch to master.
    2. Cherry-picking the commit, adding the clang-tidy test.
    3. Running the clang-tidy test as per instructions in https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md
  6. MarcoFalke commented at 2:58 PM on July 26, 2022: member

    Not sure about readability failing checks. There seems to be no risk in leaving this as the original author picked it, just like picking a variable name.

    Also, given that a CI failure will not print the error easily accessible right now, I can think that readability checks may frustrate contributors.

  7. fanquake commented at 3:04 PM on July 26, 2022: member

    There seems to be no risk in leaving this as the original author picked it, just like picking a variable name.

    There might be no risk, but there's also no point to the code being removed. It's just verbose, and inconsistent with the rest of the codebase. I disagree that this is somehow similar to picking variable names.

  8. MarcoFalke commented at 3:14 PM on July 26, 2022: member

    Well, fine then. Though, I still think we should make the dev UX better than "lol, CI is red, go figure out how to download a 100KB text file and grep for error".

  9. fanquake commented at 3:31 PM on July 26, 2022: member

    Though, I still think we should make the dev UX better than "lol, CI is red, go figure out how to download a 100KB text file and grep for error".

    Started improving that in #25713.

  10. MarcoFalke commented at 3:47 PM on July 26, 2022: member

    It probably doesn't matter for this check, but we should keep it in mind with more checks being enabled regularly now.

  11. MarcoFalke merged this on Jul 26, 2022
  12. MarcoFalke closed this on Jul 26, 2022

  13. fanquake deleted the branch on Jul 26, 2022
  14. sidhujag referenced this in commit afbdb35af3 on Jul 27, 2022
  15. PastaPastaPasta referenced this in commit 7496fb750a on Oct 18, 2022
  16. bitcoin locked this on Jul 26, 2023

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-26 06:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me