Inline assert in RTC_DCHECK_RUN_ON macro

clangd ignores ASSERT_EXCLUSIVE_LOCK macro attached to an inline function in header, thus IDEs relying on clangd issue false positive warnings about members acceesses without the check of the current sequence.
Attaching assert attribute to an inlined lambda function seems to solve that issue

Bug: None
Change-Id: I6199fee26061aa4223f2e3ea7b7b14bb5820c0bc
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/270480
Reviewed-by: Evan Shrubsole <eshr@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37678}
diff --git a/api/sequence_checker.h b/api/sequence_checker.h
index b9f466b..a79d04f 100644
--- a/api/sequence_checker.h
+++ b/api/sequence_checker.h
@@ -107,9 +107,15 @@
 #define RTC_RUN_ON(x) \
   RTC_THREAD_ANNOTATION_ATTRIBUTE__(exclusive_locks_required(x))
 
+// Checks current code is running on the desired sequence.
+//
+// First statement validates it is running on the sequence `x`.
+// Second statement annotates for the thread safety analyzer the check was done.
+// Such annotation has to be attached to a function, and that function has to be
+// called. Thus current implementation creates a noop lambda and calls it.
 #define RTC_DCHECK_RUN_ON(x)                                               \
   RTC_DCHECK((x)->IsCurrent())                                             \
       << webrtc::webrtc_sequence_checker_internal::ExpectationToString(x); \
-  webrtc::webrtc_sequence_checker_internal::AssertHeld(x)
+  []() RTC_ASSERT_EXCLUSIVE_LOCK(x) {}()
 
 #endif  // API_SEQUENCE_CHECKER_H_