mirror of
https://github.com/facebookincubator/mvfst.git
synced 2025-08-01 01:44:22 +03:00
Summary: Replace `[[maybe_unused]] auto variable = method_call` patterns with proper assertions using `ASSERT_FALSE(method_call.hasError())` for quic::Expected return values. This improves test reliability by actually validating method call success instead of suppressing unused return value warnings. ## Changes Made ### 1. Fixed Anti-Patterns in Tests (84 instances across 5 test files): - QuicTransportBaseTest.cpp: 74 patterns - QuicTransportTest.cpp: 5 patterns - QuicTypedTransportTest.cpp: 3 patterns - QuicClientTransportLiteTest.cpp: 1 pattern - QuicClientTransportTest.cpp: 1 pattern For cleanup scenarios where failure is acceptable (e.g., setting read callback to nullptr), used `(void)method_call` instead of assertions to properly suppress warnings without incorrect success assertions. ### 2. Removed Unhelpful Comments (5 instances): - QuicStreamAsyncTransport.cpp: Removed comments referencing "original behavior" that provided no actionable context The logging statements (WARNING/VLOG) already make error handling behavior clear without need for historical commentary. ## Comprehensive Audit Results Performed comprehensive audit of all `[[maybe_unused]]` usage in fbcode/quic/ (45 total instances): - ✅ **Self-reference guards**: `[[maybe_unused]] auto self = sharedGuard();` - **LEGITIMATE** - ✅ **Function parameter suppression**: Intentionally unused parameters - **LEGITIMATE** - ✅ **Loop variable suppression**: Iteration without using values - **LEGITIMATE** - ✅ **Static initialization**: Thread-local initialization patterns - **LEGITIMATE** - ⛔ **Third-party code**: Left untouched as required --- > Generated by [Confucius Code Assist (CCA)](https://www.internalfb.com/wiki/Confucius/Analect/Shared_Analects/Confucius_Code_Assist_(CCA)/) [Session](https://www.internalfb.com/confucius?session_id=7be75dc0-61d5-11f0-8f26-27b21c240401&tab=Chat), [Trace](https://www.internalfb.com/confucius?session_id=7be75dc0-61d5-11f0-8f26-27b21c240401&tab=Trace) Reviewed By: knekritz Differential Revision: D78385516 fbshipit-source-id: 98c8989a147ed639be4582be3460b146aaa1075f