diff options
| author | Nathan West <Lucretiel@gmail.com> | 2020-05-19 23:26:49 -0400 |
|---|---|---|
| committer | David Tolnay <dtolnay@gmail.com> | 2020-06-30 11:44:14 -0700 |
| commit | 3ab7ae39ec77a39df27ac6c3fbde03cd3b763542 (patch) | |
| tree | 96b6bd843588e18b177378da94f1615d06960577 /src/rustllvm/CoverageMappingWrapper.cpp | |
| parent | 672b272077561ca7b5027a8aff9ea2957c7d4c21 (diff) | |
| download | rust-3ab7ae39ec77a39df27ac6c3fbde03cd3b763542.tar.gz rust-3ab7ae39ec77a39df27ac6c3fbde03cd3b763542.zip | |
Bring net/parser.rs up to modern up to date with modern rust patterns
Made the following changes throughout the IP address parser:
- Replaced all uses of `is_some()` / `is_none()` with `?`.
- "Upgraded" loops wherever possible; ie, replace `while` with `for`, etc.
- Removed all cases of manual index tracking / incrementing.
- Renamed several single-character variables with more expressive names.
- Replaced several manual control flow segments with equivalent adapters (such as `Option::filter`).
- Removed `read_seq_3`; replaced with simple sequences of `?`.
- Parser now reslices its state when consuming, rather than carrying a separate state and index variable.
- `read_digit` now uses `char::to_digit`.
- Removed unnecessary casts back and forth between u8 and u32
- Added comments throughout, especially in the complex IPv6 parsing logic.
- Added comprehensive local unit tests for the parser to validate these changes.
Diffstat (limited to 'src/rustllvm/CoverageMappingWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
