Cannot remove clang-tidy warning for "Use auto when initialising with a cast to avoid duplicating the type name"

已回答

Eg for 

connection_state_enum connection_state = (connection_state_enum) event.int_data;

I've tried adding "-modernize-use-auto" to the Settings->Editor->Inspections-Clang-Tidy->Options but it makes no difference.

This is CLion 2020.2.3

0

Hello!

In Clang-Tidy some checks duplicate each other. In your case hicpp-use-auto (https://clang.llvm.org/extra/clang-tidy/checks/hicpp-use-auto.html) duplicates modernize-use-auto, so you need to disable it too.

Please note that you can disable a single check, a group of checks, or the entire Clang-Tidy inspection from the editor - https://www.jetbrains.com/help/clion/clang-tidy-checks-support.html#checkseditor.

0

Thanks Anna, adding '-hicpp-use-auto' did indeed remove warnings.

 

 

0

请先登录再写评论。