Improve code readability:
- Use
auto*instead ofautofor pointers Avoid shadowing variable- Separate assignment from function call
Remove redundant code
These changes are all exhaustive.
Improve code readability:
auto* instead of auto for pointersThese changes are all exhaustive.
243 | - ui->passEdit2->setEchoMode(mode); 244 | - ui->passEdit3->setEchoMode(mode); 245 | + const auto echoMode = show ? QLineEdit::Normal : QLineEdit::Password; 246 | + ui->passEdit1->setEchoMode(echoMode); 247 | + ui->passEdit2->setEchoMode(echoMode); 248 | + ui->passEdit3->setEchoMode(echoMode);
We don't do these changes, since it is non-trivial to prove the refactoring does the right thing: #10136
Wasn't the problem that people used ancient compilers? That this only remaining case is correct should be obvious to us humans, no? :-)
This was one of the comments:
And there is still value in compiling with Wshadow periodically (with a carefully chosen compiler) and seeing if it finds any bug.
I'm using a carefully chosen compiler :-)
this only remaining case
This clearly isn't the only remaining case.
See for example rest.cpp
auto process_utxos = [&vOutPoints, &outs, &hits](const CCoinsView& view, const CTxMemPool& mempool) {
where one of the args shadows the global mempool
Oh, I misread a report. Sorry. Reverted the shadowing change :-)
Tend to NACK. All of these are subjective style cleanups. Unless they have a major impact on developer experience or user experience, they are probably not worth to "fix".
@MarcoFalke I've removed what I see as the most "subjective" changes. Do you think that any of the remaining ones are acceptable or should I close? :-)
Hopefully separating assignment from function call should be fairly non-controversial? And using auto* instead of auto to show that a pointer is being used should be an obvious win for readability? :-)
Note that each change is exhaustive so these are the only cases.
37 | @@ -38,7 +38,7 @@ class AddressBookSortFilterProxyModel final : public QSortFilterProxyModel 38 | protected: 39 | bool filterAcceptsRow(int row, const QModelIndex& parent) const 40 | { 41 | - auto model = sourceModel(); 42 | + auto* model = sourceModel();
This change makes it harder to switch to smart pointers later, no?
Closing I misread a report: these fixes are not exhaustive. Sorry.