Commit f24561f460aa840f280c103e85f824b2a23b5bdf
1 parent
786f99d0
Explicit casts
Showing
4 changed files
with
5 additions
and
5 deletions
.clang-tidy
| 1 | 1 | #Checks: '*,-clang-analyzer-alpha.*' |
| 2 | 2 | #Checks: '-*,google-readability-casting,llvm-namespace-comment,performance-unnecessary-value-param,llvm-include-order,misc-throw-by-value-catch-by-reference,readability-container-size-empty,google-runtime-references,modernize*' |
| 3 | -Checks: '-*,llvm-namespace-comment,llvm-include-order,readability-container-size-empty,misc-throw-by-value-catch-by-reference,modernize*' | |
| 3 | +Checks: '-*,llvm-namespace-comment,llvm-include-order,readability-container-size-empty,misc-throw-by-value-catch-by-reference,modernize*,google-readability-casting' | |
| 4 | 4 | HeaderFilterRegex: '.*hpp' |
| 5 | 5 | CheckOptions: |
| 6 | 6 | - key: readability-braces-around-statements.ShortStatementLines | ... | ... |
include/CLI/App.hpp
include/CLI/TypeTools.hpp
| ... | ... | @@ -102,7 +102,7 @@ namespace detail { |
| 102 | 102 | template<typename T, enable_if_t<std::is_integral<T>::value, detail::enabler> = detail::dummy> |
| 103 | 103 | bool lexical_cast(std::string input, T& output) { |
| 104 | 104 | try{ |
| 105 | - output = (T) std::stoll(input); | |
| 105 | + output = static_cast<T>(std::stoll(input)); | |
| 106 | 106 | return true; |
| 107 | 107 | } catch (const std::invalid_argument&) { |
| 108 | 108 | return false; |
| ... | ... | @@ -115,7 +115,7 @@ namespace detail { |
| 115 | 115 | template<typename T, enable_if_t<std::is_floating_point<T>::value, detail::enabler> = detail::dummy> |
| 116 | 116 | bool lexical_cast(std::string input, T& output) { |
| 117 | 117 | try{ |
| 118 | - output = (T) std::stold(input); | |
| 118 | + output =static_cast<T>(std::stold(input)); | |
| 119 | 119 | return true; |
| 120 | 120 | } catch (const std::invalid_argument&) { |
| 121 | 121 | return false; | ... | ... |
include/CLI/Validators.hpp
| ... | ... | @@ -81,7 +81,7 @@ std::function<bool(std::string)> Range(T min, T max) { |
| 81 | 81 | /// Range of one value is 0 to value |
| 82 | 82 | template<typename T> |
| 83 | 83 | std::function<bool(std::string)> Range(T max) { |
| 84 | - return Range((T) 0, max); | |
| 84 | + return Range(static_cast<T>(0), max); | |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | /// @} | ... | ... |