For the CICD on macOS, this fixes:
```
---- common::util::tests::test_check_coreutil_version stdout ----
---- common::util::tests::test_expected_result stdout ----
thread 'common::util::tests::test_expected_result' panicked at
'byte index 4 is out of bounds of `9.0`', tests/common/util.rs:1172:41
```
Replace two loops that print leading and trailing 0s when printing a
number in fixed-width mode with a single call to `write!()` with the
appropriate formatting parameters.
Ensure that the `print_seq_integers()` function is called when the first
number and the increment are integers, regardless of the type of the
last value specified.
Create a `DigestWriter` struct that implements `Write` by passing bytes
directly to `Digest::input()`, so that `hashsum` can use
`std::io::copy()`. Using `std::io::copy()` eliminates some boilerplate
code around reading and writing bytes. And defining `DigestWriter` makes
it easier to add a `#[cfg(windows)]` guard around the Windows-specific
replacement of "\r\n" with "\n".
Change the way `seq` computes the number of digits needed to print a
number so that it works for inputs given in scientific notation.
Specifically, this commit parses the input string to determine whether
it is an integer, a float in decimal notation, or a float in scientific
notation, and then computes the number of integral digits and the number
of fractional digits based on that. This also supports floating point
negative zero, expressed in both decimal and scientific notation.
- Attach context to I/O errors
- Make flags override each other
- Support invalid unicode as argument
- Call WsaCleanup() even on panic
- Do not use deprecated std::mem::uninitialized()
Add the `is_first_iteration` Boolean variable to the `print_seq()`
function in order to avoid unnecessary comparisons. Specifically, before
this change, the `done_printing()` function was called twice on each
iteration of the main loop. After this change, it is only called once
per iteration.
Furthermore, this change makes the `print_seq()` function similar in
structure to the `print_seq_integers()` function.
Co-authored-by: Jan Verbeek <jan.verbeek@posteo.nl>