Inspectopedia 2024.3 Help

Simplifiable statement

Reports the statements that can be simplified, such as constant conditions, identical if branches, redundant boolean expressions, and others. Use the checkboxes below to control the analysis options:

  • Simplify "if (true)", "while(false)": suggest replacing the if/while statement with a boolean literal.

  • Simplify "condition == true": suggest replacing equality statements with boolean literals.

  • Simplify "condition1 ? true : condition2;": suggest simplifying ternary operators where one of the expressions is a boolean literal.

  • Simplify "if (condition1) return true; return condition2;": suggest simplifying if where a boolean literal is returned if the condition is true and another condition is returned otherwise.

Locating this inspection

By ID

Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.

Simplify
Via Settings dialog

Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.

Settings or Preferences | Editor | Inspections | C/C++ | General

Inspection options

Here you can find the description of settings available for the Simplifiable statement inspection, and the reference of their default values.

Simplify "if (true)", "while (false)"

Default: Selected

Simplify "condition == true"

Default: Selected

Simplify "condition1 ? true : condition2"

Default: Selected

Simplify "if (condition1) return true; return condition2;"

Not selected

Inspection Details

By default bundled with:

CLion 2024.3,

Can be installed with plugin:

CLion, 2024.3

Last modified: 03 December 2024