This suggests simplifying expressions which are casting conversion functions, such as static_cast<int>(absl::ToDoubleSeconds(...))
Details
Diff Detail
Event Timeline
nit's come from running running validate_check.py on the rst file from D55523: [clang-tidy] Linting .rst documentation
$ ../clang-tidy/validate_check.py --rst abseil-duration-conversion-cast.rst
Checking abseil-duration-conversion-cast.rst...
warning: line 6 maximize 80 characters by joining:'[Checks for casts of `absl::Duration` conversion functions, and recommends]' and '[the...]
warning: line 20 multiple blank lines
warning: line 28 multiple blank lines
| docs/clang-tidy/checks/abseil-duration-conversion-cast.rst | ||
|---|---|---|
| 21 | nit: double blank line | |
| 29 | nit: double blank line | |
| 32 | nit: I believe that 'instead.' can come onto this line and still be <= 80 characters (which might actually be a bug in validate_check.py that it doesn't detect it) | |
| clang-tidy/abseil/DurationConversionCastCheck.cpp | ||
|---|---|---|
| 42 | Please run Clang-format. | |
| clang-tidy/abseil/DurationComparisonCheck.cpp | ||
|---|---|---|
| 47–48 | I think this change (and the related removal) should be landed separately as a NFC commit once this one lands, as it's logically separate from the new check. | |
| clang-tidy/abseil/DurationConversionCastCheck.cpp | ||
| 46 | You can drop the llvm:: qualifiers here and elsewhere. | |
| 52 | Add a full stop to the end of the comment (same below). | |
| 57 | This diagnostic message does not tell the user what they did wrong with their code. How about duration should be converted directly to integer|floating-point rather than through a type cast or something along those lines? | |
| test/clang-tidy/abseil-duration-conversion-cast.cpp | ||
| 10 | Can you add an example like: typedef int FancyInt; FancyInt j = static_cast<FancyInt>(absl::ToDoubleHours(d1)); to make sure the cast is looking through types as expected? Please add a similar test for floating-point casts. | |
Address reviewer comments
| clang-tidy/abseil/DurationComparisonCheck.cpp | ||
|---|---|---|
| 47–48 | I've gone ahead and done the change separately, which should clean this up. | |
I think this change (and the related removal) should be landed separately as a NFC commit once this one lands, as it's logically separate from the new check.