Commit 1d2adce
Use := instead of => for map updates when key was pattern matched
Summary:
This diff updates 20 modules across the codebase to use the := operator instead of => when updating map keys that were previously extracted via pattern matching.
In Erlang maps:
- => is the associative operator that can create or update keys
- := is the exact match operator that only updates existing keys
When a key is already known to exist (because it was pattern matched earlier in the same function), using := is preferred because:
1. It's more semantically correct - it explicitly states the key must exist
2. The compiler can potentially optimize the operation since it doesn't need to handle the 'key not found' case
Files updated:
- wa_async_crawler_zippy_integrity.erl
- call_genai_cathode.erl
- relay_fallback_data.erl
- one_to_one_data.erl
- channeld_protocol_mex_utils.erl
- handle_iq_encrypt.erl
- strong_auth.erl
- signal_protocol_core.erl
- genai_call_info.erl
- groupd_protocol_mex_wid_normalizer.erl
- kvdb_txn_coordinator.erl
- kvdb_core_info.erl
- msg_events.erl
- push_token_verifier.erl
- wa_dynostats.erl
- wa_gauge_registry.erl
- chatd_handler_recorder.erl
- lid_enrichment.erl
- wa_mex_response.erl
- wa_raft_transport.erl
NOTE: We encourage you to commandeer this GenAI-created diff for collaborative edits and verification.
---
> [Session](https://www.internalfb.com/confucius?session_id=f33d33cd-fc77-11f0-be50-4857dd117563&tab=Chat) | Prompt: find instances where we extract value of a key from a map via pattern matching, and then attempt to update this key with a new value, and make sure the udpate happens via := operator instead of =>. update only source modules (no tests). update no more than 20 modules. do not update modules in folder util. create a diff. | Owner: `ashturm`
Differential Revision: D91703917
fbshipit-source-id: 238f1174f65619f30e3d2afe3634ced5a8df9bca1 parent 2ff5396 commit 1d2adce
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
555 | 555 | | |
556 | 556 | | |
557 | 557 | | |
558 | | - | |
| 558 | + | |
559 | 559 | | |
560 | 560 | | |
561 | 561 | | |
| |||
0 commit comments