-
-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
more clang-tidy fixes #299
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -163,22 +163,16 @@ Block::Block() : | |
|
||
inline BlockTransfer* | ||
Block::find(const PeerInfo* p) { | ||
BlockTransfer* transfer; | ||
|
||
if ((transfer = find_queued(p)) != NULL) | ||
if (auto transfer = find_queued(p)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The style we use is to always check against nullptr. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. right. this is a C++17 feature. Would you prefer
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, but add an empty line between them. |
||
return transfer; | ||
else | ||
return find_transfer(p); | ||
return find_transfer(p); | ||
} | ||
|
||
inline const BlockTransfer* | ||
Block::find(const PeerInfo* p) const { | ||
const BlockTransfer* transfer; | ||
|
||
if ((transfer = find_queued(p)) != NULL) | ||
if (auto transfer = find_queued(p)) | ||
return transfer; | ||
else | ||
return find_transfer(p); | ||
return find_transfer(p); | ||
} | ||
|
||
inline void | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes it more difficult to read.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about removing the cast and just returning
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, the style I used originally makes it very clear what is happening at a glance, while you have to think more with the compact style you are suggesting.