Skip to content

Commit

Permalink
Enable modernize-avoid-bind in clang tidy
Browse files Browse the repository at this point in the history
Summary:
changelog: [internal]

I will be enabling more clang tidy rules in Fabric to make it easier for new contributors and standardise the codebase. \
You can read more about the rule in https://clang.llvm.org/extra/clang-tidy/checks/modernize-avoid-bind.html

Reviewed By: ShikaSD

Differential Revision: D33162192

fbshipit-source-id: b4bb332f3134c42c49559a8baf10aeb7a7fdd87f
  • Loading branch information
sammy-SC authored and facebook-github-bot committed Dec 20, 2021
1 parent 3bd1159 commit dc5cae5
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions ReactCommon/react/renderer/.clang-tidy
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
InheritParentConfig: true
Checks: '>
clang-diagnostic-*,
modernize-avoid-bind,
'
...
4 changes: 2 additions & 2 deletions ReactCommon/react/renderer/core/EventBeat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ void EventBeat::induce() const {
// Default implementation does nothing.
}

void EventBeat::setBeatCallback(const BeatCallback &beatCallback) {
beatCallback_ = beatCallback;
void EventBeat::setBeatCallback(BeatCallback beatCallback) {
beatCallback_ = std::move(beatCallback);
}

} // namespace react
Expand Down
2 changes: 1 addition & 1 deletion ReactCommon/react/renderer/core/EventBeat.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class EventBeat {
* Sets the beat callback function.
* The callback is must be called on the proper thread.
*/
void setBeatCallback(const BeatCallback &beatCallback);
void setBeatCallback(BeatCallback beatCallback);

protected:
/*
Expand Down
2 changes: 1 addition & 1 deletion ReactCommon/react/renderer/core/EventQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ EventQueue::EventQueue(
: eventProcessor_(std::move(eventProcessor)),
eventBeat_(std::move(eventBeat)) {
eventBeat_->setBeatCallback(
std::bind(&EventQueue::onBeat, this, std::placeholders::_1));
[this](jsi::Runtime &runtime) { onBeat(runtime); });
}

void EventQueue::enqueueEvent(RawEvent &&rawEvent) const {
Expand Down

0 comments on commit dc5cae5

Please sign in to comment.