Warning, /sdk/clazy/docs/checks/README-unneeded-cast.md is written in an unsupported language. File is not indexed.
0001 # unneeded-cast 0002 0003 Finds unneeded qobject_cast, static_cast and dynamic_casts. 0004 Warns when you're casting to base or casting to the same type, which doesn't require 0005 any explicit cast. 0006 0007 Also warns when you're using dynamic_cast for QObjects. qobject_cast is preferred. 0008 0009 0010 #### Example 0011 0012 Foo *a = ...; 0013 Foo *b = qobject_cast<Foo*>(a); 0014 0015 0016 To shut the warnings about using qobject_cast over dynamic cast you can set: 0017 `export CLAZY_EXTRA_OPTIONS="unneeded-cast-prefer-dynamic-cast-over-qobject"` 0018 0019 NOTE: This check has many false-positives. For example, you might cast to base 0020 class to call a non-virtual method, or qobject_cast to itself to check if the 0021 `QObject` destructor is currently being run.