[PATCH] D131985: clang-tidy: strip useless parens from `return` statements

Eugene Zelenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 16 16:30:22 PDT 2022


Eugene.Zelenko added a comment.

In D131985#3727544 <https://reviews.llvm.org/D131985#3727544>, @oleg.smolsky wrote:

> In D131985#3727436 <https://reviews.llvm.org/D131985#3727436>, @njames93 wrote:
>
>> The idea of this check is good, but restricting it to only return statements seems baffling. A general check that could remove useless parens would have a lot more value.
>
> Of course a more general check would be more generally useful. Yet that requires a lot more code as handling many more contexts in involved in C++.
>
> Basically this change addresses a concrete, somewhat wide-spread silly habit that exists in the wild.

I recently observed in the wild patterns like:

  std::vector<std::string> data;
  
  for (std::vector<std::string>::iterator it = data.begin(); it != data.end(); ++it)
    std::cout << (*it) << std::endl;


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131985/new/

https://reviews.llvm.org/D131985



More information about the cfe-commits mailing list