dylint
dylint copied to clipboard
Extend `wrong_serialize_struct_arg` to handle `serialize_struct_variant`, etc.
wrong_serialize_struct_arg is here: https://github.com/trailofbits/dylint/tree/master/examples/general/wrong_serialize_struct_arg
Additional methods it might handle are the following:
- [ ] serialize_struct_variant
- [ ] serialize_tuple
- [ ] serialize_tuple_struct
- [ ] serialize_tuple_variant
The ones that are not serialize_tuple should be straightforward, as they also involve calls to serialize_field. The main changes should be:
- Changing the path that is checked for: https://github.com/trailofbits/dylint/blob/d75ae91f34613a329a231797a0142066194b5f3d/examples/general/wrong_serialize_struct_arg/src/lib.rs#L125
- Changing how the
lenargument is extracted: https://github.com/trailofbits/dylint/blob/d75ae91f34613a329a231797a0142066194b5f3d/examples/general/wrong_serialize_struct_arg/src/lib.rs#L126-L127 - Adjusting the diagnostic message: https://github.com/trailofbits/dylint/blob/d75ae91f34613a329a231797a0142066194b5f3d/examples/general/wrong_serialize_struct_arg/src/lib.rs#L103-L106
Handling serialize_tuple will be slightly more involved, as it requires counting calls to serialize_element instead of serialize_field.