Remove unnecessary std::string = "" initializations. Enable readability-redundant-string-init.
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-
fanquake commented at 9:27 AM on July 26, 2022: member
-
refactor: remove unnecessary string initializations 4ddd746bf9
-
49168df073
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
- shaavan approved
-
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:
- Resetting the branch to master.
- Cherry-picking the commit, adding the clang-tidy test.
- Running the clang-tidy test as per instructions in https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md
-
MarcoFalke commented at 2:58 PM on July 26, 2022: member
Not sure about
readabilityfailing 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
readabilitychecks may frustrate contributors. -
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.
-
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". -
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.
- MarcoFalke merged this on Jul 26, 2022
- MarcoFalke closed this on Jul 26, 2022
- fanquake deleted the branch on Jul 26, 2022
- sidhujag referenced this in commit afbdb35af3 on Jul 27, 2022
- PastaPastaPasta referenced this in commit 7496fb750a on Oct 18, 2022
- bitcoin locked this on Jul 26, 2023