1.. title:: clang-tidy - abseil-duration-factory-float 2 3abseil-duration-factory-float 4============================= 5 6Checks for cases where the floating-point overloads of various 7``absl::Duration`` factory functions are called when the more-efficient 8integer versions could be used instead. 9 10This check will not suggest fixes for literals which contain fractional 11floating point values or non-literals. It will suggest removing 12superfluous casts. 13 14Examples: 15 16.. code-block:: c++ 17 18 // Original - Providing a floating-point literal. 19 absl::Duration d = absl::Seconds(10.0); 20 21 // Suggested - Use an integer instead. 22 absl::Duration d = absl::Seconds(10); 23 24 25 // Original - Explicitly casting to a floating-point type. 26 absl::Duration d = absl::Seconds(static_cast<double>(10)); 27 28 // Suggested - Remove the explicit cast 29 absl::Duration d = absl::Seconds(10); 30