<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/64914>64914</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Readability check to suggest replacement of conditional statement with std::min/std::max
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-tidy,
check-request
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
EugeneZelenko
</td>
</tr>
</table>
<pre>
It'll be great to add readability check to suggest replacement of conditional statement with `std::min/std::max`. For example:
```
if (value1 < value2)
value1 = value2; // value1 = std::max(value1, value2);
if (value2 < value1)
value1 = value2; // value1 = std::min(value1, value2);
```
`value2` may be expression, number, etc.
See also PyLint's [consider-using-min-builtin](https://pylint.pycqa.org/en/latest/user_guide/messages/refactor/consider-using-min-builtin.html) and [consider-using-max-builtin](https://pylint.pycqa.org/en/latest/user_guide/messages/refactor/consider-using-max-builtin.html).
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8U8tu2zAQ_JrVhbBArR62DjrEcQUU6KFob70UFLWW2VCkw0dq_31BJY6TPnJpUUCQSI60M6PBCO_VZIg6qLdQ7zIRw8G67l2cyNAX0mTubDbY8dy9D4BrrdlAbHIkAguWiXFkjsQoBqVVODN5IHmXAB-niXxgjo5aSJrJBGb3TFozqqCsEZr5IMIj8F2FA4OG-zBCeQPlzawMYH_dihM0PGe9dYxOYj5qSgDfAb_cG_50LVu1Z4CbB6EjFQzKW7YsEbB9xBl7xnYXrNwywB6wf4m9knCZCPhyYLn9hROvnMXfcKa_8CbnT7afD5_ebDibxTkFRqejI--VNWmQifNALq0oyPzlt5-JmNDeso_nD8qkwD2Deiut8Wokt4pemWk1K7MaotJBGah3gJtDCEefRC9mjmetTMiPZ3kvcusmwJ5SnloE8gGwj57c1ymqkQD7mbwXE3nA3tFeyGAdYP9nxvwQZg3YMmHG32kTp_-t7cp40ZZnY1eObdmKjLqiaXFdFy0vskPH13woqCgKEtjKcl3VxboSFadRVmNDm0x1yLHkGyw5r4uqyBs5DNW-GVpZV1hQBRWnWSida_0wJwuZ8j5S11RtUWVaDKT9UmZEqYWZVkGNZ0AEvE1HqaArR_dxsYup8q5Lo1ZDnDxUXCsf_HV4UEFT9-nfdPyNgmfR6e51VpMKhzjk0s4pIP1weayOzn4jmdJarKd4Fvc_AgAA__8mDIYZ">